function testLocateAll() { $locator = new lmbFileLocator($mock = new MockFileLocations()); $mock->expectOnce('getLocations'); $mock->setReturnValue('getLocations', array(dirname(__FILE__) . '/design/', dirname(__FILE__) . '/design/_en/')); $all_files = $locator->locateAll('*.html'); sort($all_files); $this->assertEqual(lmbFs::normalizePath($all_files[0]), lmbFs::normalizePath(dirname(__FILE__) . '/design/test1.html')); $this->assertEqual(lmbFs::normalizePath($all_files[1]), lmbFs::normalizePath(dirname(__FILE__) . '/design/_en/test1.html')); }
function testGetLocationsComplicatedTest() { $mock1 = new MockFileLocations(); $mock1->expectOnce('getLocations'); $mock1->setReturnValue('getLocations', array('path2', 'path3')); $mock2 = new MockFileLocations(); $mock2->expectOnce('getLocations'); $mock2->setReturnValue('getLocations', array('path4', 'path5')); $locations = new lmbFileLocationsList(array('path0', 'path1', $mock1), $mock2, 'path6'); $paths = $locations->getLocations(); $this->assertEqual(sizeof($paths), 7); $this->assertPathsEqual($paths[0], 'path0'); $this->assertPathsEqual($paths[1], 'path1'); $this->assertPathsEqual($paths[2], 'path2'); $this->assertPathsEqual($paths[3], 'path3'); $this->assertPathsEqual($paths[4], 'path4'); $this->assertPathsEqual($paths[5], 'path5'); $this->assertPathsEqual($paths[6], 'path6'); }