public function testHomeDirectory() { $this->assertAttributeEquals(null, '_defaultHomePath', '\\Org\\Heigl\\Hyphenator\\Hyphenator'); $h = new h\Hyphenator(); $baseDirectory1 = dirname(__DIR__) . '/src/Org/Heigl/Hyphenator/share'; $this->assertEquals($baseDirectory1, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory1, $h->getHomePath()); $baseDirectory2 = __DIR__ . '/share/tmp1'; mkdir($baseDirectory2); putenv('HYPHENATOR_HOME=' . $baseDirectory2); $this->assertEquals($baseDirectory2, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory2, $h->getHomePath()); rmdir($baseDirectory2); $this->assertEquals($baseDirectory1, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory1, $h->getHomePath()); $baseDirectory3 = __DIR__ . '/share/tmp2'; mkdir($baseDirectory3); define('HYPHENATOR_HOME', $baseDirectory3); $this->assertEquals($baseDirectory3, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory3, $h->getHomePath()); rmdir($baseDirectory3); $this->assertEquals($baseDirectory1, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory1, $h->getHomePath()); $baseDirectory4 = __DIR__ . '/share/tmp3'; mkdir($baseDirectory4); \Org\Heigl\Hyphenator\Hyphenator::setDefaultHomePath($baseDirectory4); $this->assertEquals($baseDirectory4, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory4, $h->getHomePath()); rmdir($baseDirectory4); $this->assertEquals($baseDirectory1, \Org\Heigl\Hyphenator\Hyphenator::getDefaultHomePath()); $this->assertEquals($baseDirectory1, $h->getHomePath()); $baseDirectory5 = __DIR__ . '/share/tmp4'; mkdir($baseDirectory5); $h->setHomePath($baseDirectory5); $this->assertAttributeEquals($baseDirectory5, '_homePath', $h); $this->assertEquals($baseDirectory5, $h->getHomePath()); rmdir($baseDirectory5); $this->assertEquals($baseDirectory1, $h->getHomePath()); }