Thavarshan
6 months ago

Blade CompilerTest Failing

Posted 6 months ago by Thavarshan

I've been testing the Laravel frameworks tests specifically the Blade compiler tests just so I can get an understanding of how things work. I'd like to make my own template compiler (Just for the sake of learning).

Four of the tests in the ViewBladeCompilerTest.php file fail and output the following:

Mockery\Exception\NoMatchingExpectationException: No matching handler found for Mockery_0_Illuminate_Filesystem_Filesystem::put('/Users/thavarshan/Codebase/Valet/framework/tests/View/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33.php', 'Hello World'). Either the method was unexpected or its arguments matched no expected argument list for this method


/Users/thavarshan/Codebase/Valet/framework/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php:92
/Users/thavarshan/Codebase/Valet/framework/src/Doktrin/View/Compilers/BladeCompiler.php:126
/Users/thavarshan/Codebase/Valet/framework/tests/View/ViewBladeCompilerTest.php:53
/Users/thavarshan/Codebase/Valet/framework/vendor/phpunit/phpunit/phpunit:61

The test would be:

public function testCompileCompilesFileAndReturnsContents()
{
    $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__);

    $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World');
    $files->shouldReceive('put')->once()
        ->with(__DIR__ . '/' . sha1('foo') . '.php', "Hello World\n<?php /* foo */ ?>");

    $compiler->compile('foo');
}

Anyone know why and how I can fix it?

I've been fiddling around with the code but haven't changed anything.

Please sign in or create an account to participate in this conversation.