|
|
@@ -1188,14 +1188,14 @@ class Zend_Filter_InputTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testGetPluginLoader()
|
|
|
{
|
|
|
- $input = new Zend_Filter_Input(null, null);
|
|
|
+ $input = new Zend_Filter_Input(null, null);
|
|
|
|
|
|
- $loader = $input->getPluginLoader(Zend_Filter_Input::VALIDATE);
|
|
|
+ $loader = $input->getPluginLoader(Zend_Filter_Input::VALIDATE);
|
|
|
$this->assertType('Zend_Loader_PluginLoader', $loader,
|
|
|
'Expected object of type Zend_Loader_PluginLoader, got ' , get_class($loader));
|
|
|
|
|
|
try {
|
|
|
- $loader = $input->getPluginLoader('foo');
|
|
|
+ $loader = $input->getPluginLoader('foo');
|
|
|
$this->fail('Expected to catch Zend_Filter_Exception');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Filter_Exception', $e,
|
|
|
@@ -1208,21 +1208,21 @@ class Zend_Filter_InputTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testSetPluginLoader()
|
|
|
{
|
|
|
- $input = new Zend_Filter_Input(null, null);
|
|
|
+ $input = new Zend_Filter_Input(null, null);
|
|
|
|
|
|
- $loader = new Zend_Loader_PluginLoader();
|
|
|
+ $loader = new Zend_Loader_PluginLoader();
|
|
|
|
|
|
- $input->setPluginLoader($loader, Zend_Filter_Input::VALIDATE);
|
|
|
+ $input->setPluginLoader($loader, Zend_Filter_Input::VALIDATE);
|
|
|
}
|
|
|
|
|
|
public function testSetPluginLoaderInvalidType()
|
|
|
{
|
|
|
- $input = new Zend_Filter_Input(null, null);
|
|
|
+ $input = new Zend_Filter_Input(null, null);
|
|
|
|
|
|
- $loader = new Zend_Loader_PluginLoader();
|
|
|
+ $loader = new Zend_Loader_PluginLoader();
|
|
|
|
|
|
try {
|
|
|
- $input->setPluginLoader($loader, 'foo');
|
|
|
+ $input->setPluginLoader($loader, 'foo');
|
|
|
$this->fail('Expected to catch Zend_Filter_Exception');
|
|
|
} catch (Zend_Exception $e) {
|
|
|
$this->assertType('Zend_Filter_Exception', $e,
|
|
|
@@ -1782,6 +1782,29 @@ class Zend_Filter_InputTest extends PHPUnit_Framework_TestCase
|
|
|
$this->fail();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @group ZF-7135
|
|
|
+ */
|
|
|
+ public function testValidatorAllowNull()
|
|
|
+ {
|
|
|
+ $data = array(
|
|
|
+ 'field1' => null
|
|
|
+ );
|
|
|
+ $validators = array(
|
|
|
+ 'field1' => array(
|
|
|
+ 'notEmpty'
|
|
|
+ )
|
|
|
+ );
|
|
|
+ $input = new Zend_Filter_Input(null, $validators, $data);
|
|
|
+
|
|
|
+ $this->assertFalse($input->hasMissing(), 'Expected hasMissing() to return false');
|
|
|
+ $this->assertTrue($input->hasInvalid(), 'Expected hasInvalid() to return true');
|
|
|
+ $this->assertFalse($input->hasUnknown(), 'Expected hasUnknown() to return false');
|
|
|
+ $this->assertFalse($input->hasValid(), 'Expected hasValid() to return true');
|
|
|
+
|
|
|
+ $this->assertNull($input->field1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class MyZend_Filter_Date implements Zend_Filter_Interface
|