Index: tests/t3lib/tree/t3lib_tree_nodeTest.php =================================================================== --- tests/t3lib/tree/t3lib_tree_nodeTest.php (revision 9850) +++ tests/t3lib/tree/t3lib_tree_nodeTest.php (working copy) @@ -30,10 +30,28 @@ * @subpackage t3lib */ class t3lib_tree_NodeTest extends tx_phpunit_testcase { - public function setUp() { - } + ////////////////////// + // Utility functions + ////////////////////// + + /** + * Returns the absolute fixtures path for this testcase. + * + * @return string the absolute fixtures path for this testcase, will not be empty + */ + private function determineFixturesPath() { + $possibleFixturesPath1 = PATH_site . 'tests/t3lib/tree/fixtures/'; + $possibleFixturesPath2 = PATH_site . 'typo3_src/tests/t3lib/tree/fixtures/'; + + if (file_exists($possibleFixturesPath1)) { + $fixturesPath = $possibleFixturesPath1; + } elseif (file_exists($possibleFixturesPath2)) { + $fixturesPath = $possibleFixturesPath2; + } else { + $this->fail('The fixtures path could not be determined.'); + } - public function tearDown() { + return $fixturesPath; } protected function setUpNodeTestData() { @@ -67,11 +85,16 @@ return $fixture; } + + /////////////// + // Test cases + /////////////// + /** * @test */ public function serializeFixture() { - $expected = trim(file_get_contents(PATH_site . 'tests/t3lib/tree/fixtures/serialized.txt')); + $expected = trim(file_get_contents($this->determineFixturesPath() . 'serialized.txt')); $fixture = $this->setUpNodeTestData(); $serializedString = trim($fixture->serialize()); $this->assertSame($expected, $serializedString); @@ -81,8 +104,8 @@ * @test */ public function deserializeFixture() { - $source = trim(file_get_contents(PATH_site . 'tests/t3lib/tree/fixtures/serialized.txt')); - $node = new t3lib_tree_Node; + $source = trim(file_get_contents($this->determineFixturesPath() . 'serialized.txt')); + $node = new t3lib_tree_Node(); $node->unserialize($source); $serializedString = $node->serialize(); $this->assertSame($source, $serializedString); @@ -105,4 +128,4 @@ $this->assertSame(0, $compareResult); } } -?> +?> \ No newline at end of file