/** * Loads the configuration file and returns it. * * @param string $file The configuration file path. * * @return Configuration The configuration settings. */ public function loadFile($file = null) { if (null === $file) { $file = $this->getDefaultPath(); } $json = $this->json->decodeFile($file); if (isset($json->import)) { if (!Path::isAbsolute($json->import)) { $json->import = Path::join(array(dirname($file), $json->import)); } $json = (object) array_merge((array) $this->json->decodeFile($json->import), (array) $json); } $this->json->validate($this->json->decodeFile(CRATE_SCHEMA_FILE), $json); return new Configuration($file, $json); }
/** * Performs a simple test on the `Path::join()` method. Due to how simple * it is, the method is actually just re-implemented as part of the test * assertion. */ public function testJoin() { $this->assertEquals(join(DIRECTORY_SEPARATOR, array('a', 'b', 'c')), Path::join(array('a', 'b', 'c'))); }