public function __construct(PropertyAccess $conf) { parent::__construct(); $baseDir = realpath(__DIR__ . '/../../../../../'); $paths = [$baseDir . '/config/configuration.yml']; foreach ($paths as $path) { $this->addRecommendation("00" === substr(sprintf('%o', fileperms($path)), -2), "{$path} should not be readable or writeable for other users, current mode is (" . substr(sprintf('%o', fileperms($path)), -4) . ")", "Change the permissions of the \"<strong>{$path}</strong>\" file to 0600"); } if ($conf->has(['main', 'storage', 'subdefs', 'default-dir'])) { $paths[] = $conf->get(['main', 'storage', 'subdefs', 'default-dir']); } foreach ($paths as $path) { $this->addRequirement(is_writable($path), "{$path} directory must be writable", "Change the permissions of the \"<strong>{$path}</strong>\" directory so that the web server can write into it."); } }
/** * @dataProvider provideHasData */ public function testHas($conf, $props, $expected) { $propAccess = new PropertyAccess(new MockArrayConf($conf)); $this->assertSame($expected, $propAccess->has($props)); }