mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
42 lines
945 B
PHP
42 lines
945 B
PHP
<?php
|
|
namespace Respect\Validation\Rules;
|
|
|
|
class NullValueTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $object;
|
|
|
|
protected function setUp()
|
|
{
|
|
$this->object = new NullValue;
|
|
}
|
|
|
|
public function testNullValue()
|
|
{
|
|
$this->assertTrue($this->object->assert(null));
|
|
$this->assertTrue($this->object->__invoke(null));
|
|
$this->assertTrue($this->object->check(null));
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerForNotNull
|
|
* @expectedException Respect\Validation\Exceptions\NullValueException
|
|
*/
|
|
public function testNotNull($input)
|
|
{
|
|
$this->assertFalse($this->object->__invoke($input));
|
|
$this->assertFalse($this->object->assert($input));
|
|
}
|
|
|
|
public function providerForNotNull()
|
|
{
|
|
return array(
|
|
array(''),
|
|
array(0),
|
|
array('w poiur'),
|
|
array(' '),
|
|
array('Foo'),
|
|
);
|
|
}
|
|
|
|
}
|
|
|