Skip to content

Commit

Permalink
Merge pull request #20 from assertis/date_list
Browse files Browse the repository at this point in the history
DateList object introduced
  • Loading branch information
orzeuek authored Sep 8, 2016
2 parents 8791966 + 4a70271 commit f314b02
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/DateList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Assertis\Util;

/**
* @author Rafał Orłowski <[email protected]>
*/
class DateList extends ObjectList
{

/**
* Return true if the value is acceptable for this list. Typically something like:
* return $value instanceof MyClass
*
* @param mixed $value
* @return boolean
*/
public function accepts($value)
{
return $value instanceof Date;
}
}
21 changes: 21 additions & 0 deletions tests/DateListTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Assertis\Util;

use Assertis\Util\DateList;
use PHPUnit_Framework_TestCase;

/**
* @author Rafał Orłowski <[email protected]>
*/
class DateListTest extends PHPUnit_Framework_TestCase
{

public function testAccept()
{
$dateList = new DateList();
$this->assertTrue($dateList->accepts(new Date("2016-10-10")));
$this->assertFalse($dateList->accepts("2016-10-10"));
}

}

0 comments on commit f314b02

Please sign in to comment.