Top "Mockery" questions

Mockery is a PHP library used to create Mocks of Objects for testing purpose.

PHPUnit Mock an object's properties

I'm looking for a way to mock an object and populate its properties. Here's an example of a method who …

php unit-testing mocking phpunit mockery
Mocking Laravel Eloquent models - how to set a public property with Mockery

I want to use a mock object (Mockery) in my PHPUnit test. The mock object needs to have both some …

php laravel eloquent mockery
Mockery no matching handler for closure

I can't figure out why I'm getting this error during this test. My test appears to be matching the rest …

php laravel mockery
Is it possible to mock protected properties and methods

Is it possible to mock a protected property with PHP Mockery? I got a class with a method, I will …

php mocking phpunit protected mockery
Mockery & PHPUnit: method does not exist on this mock object

Can you tell me where's the problem? I have a file GeneratorTest.php with the following tests: <?php namespace …

php unit-testing mocking phpunit mockery
Mockery and Laravel constructor injection

I am using laravel 5 with php unit to create a laravel package. I have a Repository.. namespace Myname\Myapp\Repositories; …

php laravel phpunit mockery
Laravel mockery

I am trying to set up the simplest of tests in my controller but, as with most things Laravel, there …

unit-testing laravel mockery
Laravel Mock with Mockery has error "no expectations were specified"

I have this Service class and use repository class in my Service : class VisitorStatisticAction { protected $repository; public function __construct(VisitorStatisticRepository $…

laravel unit-testing mockery
Mockery specifying expected arguments for multiple calls

I am trying to mock an object that gets two calls to the same function but with different arguments. It's …

php symfony mocking phpunit mockery
Mock should be called exactly 1 times but called 0 times

I have weird problem with Laravel 5 and PHPUnit. When I try to mock Laravel's facades (e.g. Auth, View, Mail) …

php laravel unit-testing mockery