| [ 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/fs/src/lmbFileLocations.interface.php'); 10 lmb_require('limb/fs/src/lmbFileLocationsList.class.php'); 11 12 Mock :: generate('lmbFileLocations', 'MockFileLocations'); 13 14 class lmbFileLocationsListTest extends UnitTestCase 15 { 16 function testGetLocations() 17 { 18 $mock = new MockFileLocations(); 19 $mock->expectOnce('getLocations'); 20 $mock->setReturnValue('getLocations', array('path1', 'path2')); 21 22 $locations = new lmbFileLocationsList('path0', $mock, 'path3'); 23 24 $paths = $locations->getLocations(); 25 26 $this->assertEqual(sizeof($paths), 4); 27 $this->assertPathsEqual($paths[0], 'path0'); 28 $this->assertPathsEqual($paths[1], 'path1'); 29 $this->assertPathsEqual($paths[2], 'path2'); 30 $this->assertPathsEqual($paths[3], 'path3'); 31 } 32 33 function testGetLocationsUseArrayInConstructor() 34 { 35 $mock = new MockFileLocations(); 36 $mock->expectOnce('getLocations'); 37 $mock->setReturnValue('getLocations', array('path2', 'path3')); 38 39 $locations = new lmbFileLocationsList(array('path0', 'path1', $mock)); 40 41 $paths = $locations->getLocations(); 42 43 $this->assertEqual(sizeof($paths), 4); 44 $this->assertPathsEqual($paths[0], 'path0'); 45 $this->assertPathsEqual($paths[1], 'path1'); 46 $this->assertPathsEqual($paths[2], 'path2'); 47 $this->assertPathsEqual($paths[3], 'path3'); 48 } 49 50 function testGetLocationsComplicatedTest() 51 { 52 $mock1 = new MockFileLocations(); 53 $mock1->expectOnce('getLocations'); 54 $mock1->setReturnValue('getLocations', array('path2', 'path3')); 55 56 $mock2 = new MockFileLocations(); 57 $mock2->expectOnce('getLocations'); 58 $mock2->setReturnValue('getLocations', array('path4', 'path5')); 59 60 $locations = new lmbFileLocationsList(array('path0', 'path1', $mock1), $mock2, 'path6'); 61 62 $paths = $locations->getLocations(); 63 64 $this->assertEqual(sizeof($paths), 7); 65 $this->assertPathsEqual($paths[0], 'path0'); 66 $this->assertPathsEqual($paths[1], 'path1'); 67 $this->assertPathsEqual($paths[2], 'path2'); 68 $this->assertPathsEqual($paths[3], 'path3'); 69 $this->assertPathsEqual($paths[4], 'path4'); 70 $this->assertPathsEqual($paths[5], 'path5'); 71 $this->assertPathsEqual($paths[6], 'path6'); 72 } 73 74 function assertPathsEqual($path1, $path2, $msg=false) 75 { 76 $this->assertEqual(rtrim(lmbFs :: normalizePath($path1), '/\\'), 77 rtrim(lmbFs :: normalizePath($path2), '/\\'), 78 $msg); 79 } 80 } 81 82 ?>
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 |