-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed

Description
I am writing a package which uses Illuminate\Validation, but when I run phpunit I get the following error message. The package is being used outside of Laravel, but as I understand it Illuminate packages are seperate from Laravel?
PHPUnit 3.7.19 by Sebastian Bergmann.
Configuration read from /vagrant/phpunit.xml
...PHP Fatal error: Call to a member function make() on a non-object in /vagrant/vendor/illuminate/support/Illuminate/Support/Facades/Facade.php on line 172
I am testing a Validator service in my models directory with the following unit test.
class UserValidator {
public static function getValidator(User $user)
{
$rules = [
'first_name' => 'required|max:50',
'last_name' => 'required|max:50',
'email' => 'required|email|unique:users,email,' . $user->id
];
$messages = [];
return Validator::make($user->toArray(), $rules, $messages);
}
}
public function testUseServiceValidatorPasses()
{
$m = m::mock('Larrytech\Auth\Models\User[toArray]');
$m->shouldReceive('toArray')->andReturn(['first_name' => 'Joe', 'last_name' => 'Bloggs', 'email' => 'Joe Bloggs']);
$v = UserValidator::getValidator($m);
$this->assertTrue($v->passes());
}
My composer.json has the following dependencies.
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.0.x",
"illuminate/foundation": "4.0.x",
"mockery/mockery": "0.7.2"
},
Many thanks!
Metadata
Metadata
Assignees
Labels
No labels