public function testCompileCommandSuccessWhenOutputDirDoesNotExist() { BladeCompiler::shouldReceive('setCachePath')->once()->shouldReceive('compile')->once(); // same amount of times as files provided by glob() File::shouldReceive("isDirectory")->once()->andReturn(false)->shouldReceive('makeDirectory')->once()->andReturn(true)->shouldReceive('glob')->once()->andReturn(array("test.php")); $commandTester = new CommandTester(new CompileCommand()); $commandTester->execute(array()); $expected = "blade templates found and successfully compiled\n"; $this->assertStringEndsWith($expected, $commandTester->getDisplay()); }
public function testCompileGetsFileContents() { $testPath = "/test"; BladeCompiler::setCachePath($testPath); $contents = 'file contents'; $mock = File::shouldReceive('get')->once()->andReturn($contents)->shouldReceive('put')->once()->getMock(); $expected = BladeCompiler::getCompiledPath($testPath); BladeCompiler::setFiles($mock); $this->assertEquals($expected, BladeCompiler::compile($testPath)); }