Example #1
0
 public function testSerialization()
 {
     $id = Uuid::createNew();
     $user = new User($id, 'foo', 'bar', 'name', 1);
     $serialized = $user->serialize();
     $deserialized = User::deserialize($serialized);
     self::assertEquals($user, $deserialized);
 }
 public function testGetUserByEmailAddressReturnsFoundUser()
 {
     $id = Uuid::createNew();
     $user = new User($id, 'user', 'foo', 'name', 0);
     $storage = $this->getMockBuilder(Storage::class)->disableOriginalConstructor()->getMock();
     $storage->expects(self::once())->method('findBy')->with(['userName' => 'user'], 0, 1)->will(self::returnValue([$user]));
     $service = new UserService($storage);
     $actualUser = $service->getUserByUserName('user');
     self::assertInstanceOf(User::class, $actualUser);
     self::assertEquals($user->getId(), $actualUser->getId());
 }