mirror of
https://github.com/Respect/Validation.git
synced 2026-03-15 23:05:45 +01:00
41 lines
1,021 B
PHP
41 lines
1,021 B
PHP
<?php
|
|
namespace Respect\Validation\Rules;
|
|
|
|
use DateTime;
|
|
|
|
class LeapDateTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $leapDateValidator;
|
|
|
|
protected function setUp()
|
|
{
|
|
$this->leapDateValidator = new LeapDate('Y-m-d');
|
|
}
|
|
|
|
public function testValidLeapDate_with_string()
|
|
{
|
|
$this->assertTrue($this->leapDateValidator->validate('1988-02-29'));
|
|
}
|
|
|
|
public function testValidLeapDate_with_date_time()
|
|
{
|
|
$this->assertTrue($this->leapDateValidator->validate(
|
|
new DateTime('1988-02-29')));
|
|
}
|
|
|
|
public function testInvalidLeapDate_with_string()
|
|
{
|
|
$this->assertFalse($this->leapDateValidator->validate('1989-02-29'));
|
|
}
|
|
|
|
public function testInvalidLeapDate_with_date_time()
|
|
{
|
|
$this->assertFalse($this->leapDateValidator->validate(
|
|
new DateTime('1989-02-29')));
|
|
}
|
|
public function testInvalidLeapDate_input()
|
|
{
|
|
$this->assertFalse($this->leapDateValidator->validate(array()));
|
|
}
|
|
}
|
|
|