Created
May 1, 2014 20:01
-
-
Save shadowhand/3a2c01a3487c9784cc0b to your computer and use it in GitHub Desktop.
phpspec test with errors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace spec\Ushahidi\Usecase\User; | |
use Ushahidi\Entity\User; | |
use Ushahidi\Entity\UserRepository; | |
use Ushahidi\Tool\Validator; | |
use PhpSpec\ObjectBehavior; | |
use Prophecy\Argument; | |
class RegisterSpec extends ObjectBehavior | |
{ | |
function let(UserRepository $repo, Validator $valid, User $user) | |
{ | |
$user->beConstructedWith([]); | |
$user->email = 'test@example.com'; | |
$user->username = 'test'; | |
$user->password = 'secret'; | |
$this->beConstructedWith($repo, $valid); | |
} | |
function it_is_initializable() | |
{ | |
$this->shouldHaveType('Ushahidi\Usecase\User\Register'); | |
} | |
function it_can_be_interacted_with($repo, $valid, $user) | |
{ | |
$data = [ | |
'email' => 'test@example.com', | |
'verify_email' => 'test@example.com', | |
'username' => 'test', | |
'password' => 'secret', | |
]; | |
$valid->check($data)->shouldBeCalled()->willReturn(true); | |
$repo->add($user)->shouldBeCalled()->willReturn(1); | |
$this->interact($data)->shouldBe(1); | |
} | |
} |
Author
shadowhand
commented
May 1, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment