public rawFileContents ( string $filePath ) : string | ||
$filePath | string | the path to the file from the project root |
return | string | The raw contents of the file |
/** * @integrationTest */ public function testRawFileContentsReal() { // Let's make sure the command we're running is legit $expectedContents = trim(shell_exec('git show HEAD:composer.json')); // Replicate the actual shell invocation that would take place Diesel::registerInstantiator('Bart\\Shell\\Command', function () { $shell = new Shell(); $args = func_get_args(); return call_user_func_array([$shell, 'command'], $args); }); $commit = new Commit(new GitRoot(BART_DIR . '/.git'), 'HEAD'); $actualContents = trim($commit->rawFileContents('composer.json')); $this->assertEquals($expectedContents, $actualContents, 'Raw file contents'); }