Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
DateStringNormalizerFilterTest.php
1 <?php
2 
17 import('lib.pkp.tests.PKPTestCase');
18 import('lib.pkp.classes.metadata.DateStringNormalizerFilter');
19 
20 class DateStringNormalizerFilterTest extends PKPTestCase {
24  public function testExecute() {
25  $filter = new DateStringNormalizerFilter();
26  self::assertEquals('2003', $filter->execute($dateString = ' 2003 '));
27  self::assertEquals('2003-07', $filter->execute($dateString = ' 2003 Jul '));
28  self::assertEquals('2003-07-05', $filter->execute($dateString = ' 2003 Jul 5 '));
29  self::assertEquals('2003', $filter->execute($dateString = ' 2003 5 '));
30  self::assertNull($filter->execute($dateString = 'unparsable string'));
31  }
32 }
33 ?>
Filter that normalizes a date string to YYYY[-MM[-DD]].
Class that implements functionality common to all PKP unit test cases.