mardi 3 mars 2020

Mockery\Exception\NoMatchingExpectationException: No matching handler found for Mockery_1_::make

I have written this test that is returning the following error:

Mockery\Exception\NoMatchingExpectationException: No matching handler found for Mockery_1_My_Class::make(array('valid_until'=>'2020-03-04',)). Either the method was unexpected or its arguments matched no expected argument list for this method

Now I have this code in my test:

$rateValidator->shouldReceive('make')->once()
            ->withArgs([$attributes])->andReturn(mockery::self());

$rateValidator->shouldReceive('addContext')
            ->withArgs(['update_rate_validity'])->andReturn(mockery::self());

And This is the code this test is testing:

$attributes = [
    'valid_until' => $command->validUntilDate
];

$validator = $this->rateValidator->make($attributes)->addContext('update_rate_validity');

What am I doing wrong here? For me the only problem could be in the arguments ($attributes) that the method make is receiving but I cant figure out what that could be?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire