/** * @Given I am a user */ public function iAmAUser() { $password = '******'; $salt = str_repeat('1', 22); $encodedPassword = $this->encoderFactory->getEncoder(AccountUser::class)->encodePassword($password, $salt); $this->accountRepository->add(Account::create(new AccountId((string) \Rhumsaa\Uuid\Uuid::uuid4()), new Credentials(new EmailAddress('*****@*****.**'), $encodedPassword, $salt))); $this->client->request('POST', '/login/', ['username' => '*****@*****.**', 'password' => $password]); $response = $this->client->getResponse(); PHPUnit_Framework_Assert::assertEquals(Response::HTTP_OK, $response->getStatusCode()); PHPUnit_Framework_Assert::assertNotNull($this->session->get('oauth_data')); }
public static function create(AccountId $id, Credentials $credentials) { $account = new Account($id, $credentials); $account->apply(new AccountWasCreated($id, $credentials)); return $account; }