mockery Questions
2
I might be missing something here but I have a very simple helper class that creates a directory:
// Helper class
<?php namespace MyApp\Helpers;
use User;
use File;
class FileSystemHelper...
1
Solved
I am trying to mock an object that gets two calls to the same function but with different arguments. It's pretty straight forward to give back different return values for multiple calls but I can't...
1
Solved
Im learning how to use mockery in order to run some unit test and Im not sure what to do to mock my database class. It consists of separate methods that can be chained like these two examples:
$db...
Departure asked 19/5, 2014 at 22:9
1
Solved
I've been using Laravel for a while now and I have been reading a lot about Dependency Injection an testable code. I've come to a point of confusion when talking about Facades and Mocked Objects. I...
Frederiksen asked 26/2, 2014 at 4:45
1
Solved
I'm very new to Laravel and unit testing in general. I'm trying to write some tests for my AccountController and I've run into a road block.
I'm using Sentry to handle users and groups in the sit...
Gilcrest asked 24/2, 2014 at 0:24
1
Solved
First I tried this
$mock = m::mock('Cartalyst\Sentry\Facades\Laravel\Sentry');
$mock->shouldReceive('getUser')->once()->andReturn($userInst);
But it gave me
Fatal error: Cannot redecla...
Maladapted asked 14/1, 2014 at 6:23
3
Solved
I'm attempting to create a Mockery of CustomObject then chain the retrieval of OtherObject onto it using something identical to
$this->CustomObject->with('OtherObject')->get();
I can't ...
Figurine asked 3/12, 2013 at 20:48
1
Solved
I use laravel (4.1) framework and i read "Laravel-testing-decoded", it's a ebook by Jeffrey Wey.
I want to test my modal User and my method setPasswordAttribute($password)
My unit-testing :
<...
Coquette asked 29/12, 2013 at 15:10
1
I'm currently writing tests for a package in Laravel 4.
I am mocking the Illuminate\Database\Query\Builder which works nearly all the time except when a where method uses a callback, I cannot chec...
Wobble asked 20/12, 2013 at 10:37
1
I've been following the general Mockery and PHP-Unit tutorials - including Jeffrey Way's introduction to testing Laravel with PHP-Unit and Mockery. However, for this app - we're fine with a depende...
Skilful asked 3/11, 2013 at 13:33
1
Solved
$client = Mockery::mock();
$client->shouldReceive('send')->andThrow($error)->andReturn(true);
Unfortunately it only returns true but not throw the exception first. How do I throw an exce...
2
I'm trying to create a mock to satisfy a typehint with this code (Mockery):
return \Mockery::mock('\Contracts\Helpers\iFileSystemWrapper');
or this (PHPUnit):
return $this->getMock('\Contrac...
Sawyor asked 26/7, 2012 at 21:15
© 2022 - 2024 — McMap. All rights reserved.