Note that there are some explanatory texts on larger screens.

plurals
  1. POClass 'Mockery' not found
    primarykey
    data
    text
    <p>I use laravel (4.1) framework and i read "Laravel-testing-decoded", it's a ebook by Jeffrey Wey.</p> <p>I want to test my modal User and my method <code>setPasswordAttribute($password)</code></p> <p>My unit-testing :</p> <pre><code>&lt;?php class UserTest extends TestCase { public function testHashesPasswordWhenSet(){ Hash::shouldReceive('make')-&gt;once()-&gt;andReturn('hashed'); $user = new User; $user-&gt;password = 'food'; $this-&gt;assertEquals('hashed', $user-&gt;password); } } </code></pre> <p>But when i launch CLI : <code>phpunit</code> it return me a error : <code>Fatal error: Class 'Mockery' not found</code></p> <p>In complete error :</p> <pre><code> Fatal error: Class 'Mockery' not found in /Applications/MAMP/htdocs/ptf/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 84 Call Stack: 0.0021 236384 1. {main}() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/composer/bin/phpunit:0 0.0294 1425104 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/composer/bin/phpunit:63 0.0294 1425336 3. PHPUnit_TextUI_Command-&gt;run() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129 0.0692 3626416 4. PHPUnit_TextUI_TestRunner-&gt;doRun() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176 0.0741 3944720 5. PHPUnit_Framework_TestSuite-&gt;run() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349 0.0741 3946368 6. PHPUnit_Framework_TestSuite-&gt;run() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705 0.0742 3946968 7. PHPUnit_Framework_TestSuite-&gt;runTest() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745 0.0742 3947000 8. PHPUnit_Framework_TestCase-&gt;run() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775 0.0743 3948232 9. PHPUnit_Framework_TestResult-&gt;run() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783 0.0754 4005504 10. PHPUnit_Framework_TestCase-&gt;runBare() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648 0.2926 15417592 11. PHPUnit_Framework_TestCase-&gt;runTest() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838 0.2926 15418872 12. ReflectionMethod-&gt;invokeArgs() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983 0.2926 15418904 13. UserTest-&gt;testHashesPasswordWhenSet() /Applications/MAMP/htdocs/ptf/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:983 0.2928 15426728 14. Illuminate\Support\Facades\Facade::shouldReceive() /Applications/MAMP/htdocs/ptf/app/tests/models/UserTest.php:7 0.2928 15426944 15. Illuminate\Support\Facades\Facade::createFreshMockInstance() /Applications/MAMP/htdocs/ptf/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:50 0.2928 15427040 16. Illuminate\Support\Facades\Facade::createMockByName() /Applications/MAMP/htdocs/ptf/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:64 </code></pre> <p>I don't understand, why i have this error.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload