function getBaseMagentoDir($path = false) { if ($path && isAboveRoot($path)) { output("Could not find base Magento directory"); exit; } $path = $path ? $path : getcwd(); if (file_exists($path . '/app/etc/di.xml')) { return realpath($path); } return getBaseMagentoDir($path . '/..'); // return $path; }
public function testIsAboveRoot4() { $path = '/foo/baz/bar/../..'; $this->assertTrue(!isAboveRoot($path)); }