file = tmpfile(); fwrite($this->file, <<file); $tmpFilename = $metaData['uri']; $files = new FilesEntry($tmpFilename, $this->findPHP()); $classes = $files->getClasses($namespace); $this->assertEquals($expected, $classes, 'FilesEntry should be able to determine the classes defined in a given file.'); } public function getClassesDataProvider() { return array( array( 'Foo\Bar', array( 'Foo\Bar\Foo', 'Foo\Bar\Bar' ) ), array( 'Baz', array( 'Baz\Boo' ) ), array( 'Stupid', array() ) ); } private function findPHP() { if (defined("PHP_BINARY")) { // PHP_BINARY was made available in PHP 5.4 $php = PHP_BINARY; } else { $isHostWindows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; if ($isHostWindows) { exec('where php', $output); $php = $output[0]; } else { exec('which php', $output); $php = $output[0]; } } return $php; } }