/** * @covers ::check */ public function testCanCallStatically() { // ---------------------------------------------------------------- // setup your test $expectedResult = false; if (file_exists('/etc/issue')) { $expectedResult = true; } // ---------------------------------------------------------------- // perform the change $actualResult = HasEtcIssue::check(); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedResult, $actualResult); }
/** * use /etc/issue (if it exists) to work out what operating system we * are looking at * * @param string $path * path to the file to parse * @return null|OsType * OsType if we can determine the operating system * null if we cannot */ public static function usingPath($path) { // make sure we have the file! if (!HasEtcIssue::check($path)) { return null; } // make sure the file is readable RequireReadableFile::check($path); // what do we have? $fileContents = file_get_contents($path); // do we have a match? return self::matchContentsToType($fileContents); }