assertEquals($expect, $helper->validateAnimalName($input)); } public function test_isInPath() { /** @var helper_plugin_farmer $helper */ $helper = plugin_load('helper', 'farmer'); $this->assertTrue($helper->isInPath('/var/www/foo', '/var/www')); $this->assertFalse($helper->isInPath('/var/www/../foo', '/var/www')); // same dir should return false, too $this->assertFalse($helper->isInPath('/var/www/foo', '/var/www/foo')); $this->assertFalse($helper->isInPath('/var/www/foo/', '/var/www/foo')); $this->assertFalse($helper->isInPath('/var/www/foo/bar/../', '/var/www/foo')); // https://github.com/cosmocode/dokuwiki-plugin-farmer/issues/30 $this->assertFalse($helper->isInPath('/var/lib/dokuwiki.animals', '/var/lib/dokuwiki')); } }