Просмотр исходного кода

[ZF-8863] Zend_Validate:

- constructor fixed

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20411 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 лет назад
Родитель
Сommit
75de4879f2
2 измененных файлов с 12 добавлено и 2 удалено
  1. 2 2
      library/Zend/Validate/Db/Abstract.php
  2. 10 0
      tests/Zend/Validate/Db/RecordExistsTest.php

+ 2 - 2
library/Zend/Validate/Db/Abstract.php

@@ -101,11 +101,11 @@ abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract
             $temp['table'] = array_shift($options);
             $temp['field'] = array_shift($options);
             if (!empty($options)) {
-                $options['exclude'] = array_shift($options);
+                $temp['exclude'] = array_shift($options);
             }
 
             if (!empty($options)) {
-                $options['adapter'] = array_shift($options);
+                $temp['adapter'] = array_shift($options);
             }
 
             $options = $temp;

+ 10 - 0
tests/Zend/Validate/Db/RecordExistsTest.php

@@ -243,4 +243,14 @@ class Zend_Validate_Db_RecordExistsTest extends PHPUnit_Framework_TestCase
             $this->markTestSkipped('No database available');
         }
     }
+
+    /**
+     * @return ZF-8863
+     */
+    public function testExcludeConstructor()
+    {
+        Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult);
+        $validator = new Zend_Validate_Db_RecordExists('users', 'field1', 'id != 1');
+        $this->assertTrue($validator->isValid('value3'));
+    }
 }