| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/i18n/src/datetime/lmbLocaleDate.class.php'); 10 11 class lmbLocaleDateTest extends UnitTestCase 12 { 13 function testCreateByLocaleString() 14 { 15 $locale = new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/../en.ini')); 16 17 $date = lmbLocaleDate :: localStringToDate($locale, 'Thursday 20 January 2005', '%A %d %B %Y'); 18 19 $this->assertEqual($date->getMonth(), 1); 20 $this->assertEqual($date->getYear(), 2005); 21 $this->assertEqual($date->getDay(), 20); 22 } 23 24 function testCreateByAnotherLocaleString() 25 { 26 $locale = new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/../en.ini')); 27 28 $date = lmbLocaleDate :: localStringToDate($locale, 'Thu 20 Jan 2005', '%a %d %b %Y'); 29 30 $this->assertEqual($date->getMonth(), 1); 31 $this->assertEqual($date->getYear(), 2005); 32 $this->assertEqual($date->getDay(), 20); 33 } 34 35 function testCreateByWrongStringThrowsException() 36 { 37 $locale = new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/../en.ini')); 38 39 try 40 { 41 $date = lmbLocaleDate :: localStringToDate($locale, '02-29-2003', '%a %d %b %Y'); 42 $this->assertTrue(false); 43 } 44 catch(lmbException $e){} 45 } 46 47 function testIsLocalStringValid() 48 { 49 $locale = new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/../en.ini')); 50 51 $this->assertTrue(lmbLocaleDate :: isLocalStringValid($locale, 'Mon 01', '%a %d')); 52 } 53 54 function testIsLocalStringNotValid() 55 { 56 $locale = new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/../en.ini')); 57 58 $this->assertFalse(lmbLocaleDate :: isLocalStringValid($locale, '02-29-2003', '%a %d %b %Y')); 59 } 60 } 61 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Nov 22 03:48:54 2008 | Cross-referenced by PHPXref 0.7 |