Skip to content

Commit

Permalink
Change ->will to ->willReturn
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Aug 6, 2024
1 parent 622add2 commit 1640553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions tests/Authentication/Adapter/ObjectRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ public function testAuthentication(): void
->expects($this->exactly(2))
->method('findOneBy')
->with($this->equalTo(['username' => 'a username']))
->will($this->returnValue($entity));
->willReturn($entity);

$objectManager = $this->createMock(ObjectManager::class);
$objectManager->expects($this->exactly(2))
->method('getRepository')
->with($this->equalTo(IdentityObject::class))
->will($this->returnValue($objectRepository));
->willReturn($objectRepository);

$adapter = new ObjectRepositoryAdapter();
$adapter->setOptions([
Expand All @@ -145,7 +145,7 @@ public function testAuthentication(): void
$result->getIdentity(),
);

$method->will($this->returnValue(null));
$method->willReturn(null);

$result = $adapter->authenticate();

Expand All @@ -164,7 +164,7 @@ public function testAuthenticationWithPublicProperties(): void
->expects($this->exactly(2))
->method('findOneBy')
->with($this->equalTo(['username' => 'a username']))
->will($this->returnValue($entity));
->willReturn($entity);

$adapter = new ObjectRepositoryAdapter();
$adapter->setOptions([
Expand All @@ -181,7 +181,7 @@ public function testAuthenticationWithPublicProperties(): void

$this->assertTrue($result->isValid());

$method->will($this->returnValue(null));
$method->willReturn(null);

$result = $adapter->authenticate();

Expand All @@ -198,7 +198,7 @@ public function testWillRefuseToAuthenticateWithoutGettersOrPublicMethods(): voi
->expects($this->once())
->method('findOneBy')
->with($this->equalTo(['username' => 'a username']))
->will($this->returnValue(new stdClass()));
->willReturn(new stdClass());

$adapter = new ObjectRepositoryAdapter();
$adapter->setOptions([
Expand Down Expand Up @@ -226,7 +226,7 @@ public function testCanValidateWithSpecialCrypt(): void
->expects($this->exactly(2))
->method('findOneBy')
->with($this->equalTo(['username' => 'username']))
->will($this->returnValue($entity));
->willReturn($entity);

$adapter = new ObjectRepositoryAdapter();
$adapter->setOptions([
Expand Down Expand Up @@ -260,7 +260,7 @@ public function testWillRefuseToAuthenticateWhenInvalidInstanceIsFound(): void
->expects($this->once())
->method('findOneBy')
->with($this->equalTo(['username' => 'a username']))
->will($this->returnValue(new stdClass()));
->willReturn(new stdClass());

$adapter = new ObjectRepositoryAdapter();
$adapter->setOptions([
Expand Down Expand Up @@ -295,7 +295,7 @@ public function testWillNotCastAuthCredentialValue(): void
->expects($this->once())
->method('findOneBy')
->with($this->equalTo(['username' => 'a username']))
->will($this->returnValue($entity));
->willReturn($entity);

$this->assertFalse($adapter->authenticate()->isValid());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Authentication/Storage/ObjectRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public function testCanRetrieveEntityFromObjectRepositoryStorage(): void
$objectRepository->expects($this->exactly(1))
->method('find')
->with($this->equalTo('a username'))
->will($this->returnValue($entity));
->willReturn($entity);

$metadata = $this->createMock(ClassMetadata::class);
$metadata->expects($this->exactly(1))
->method('getIdentifierValues')
->with($this->equalTo($entity))
->will($this->returnValue($entity->getUsername()));
->willReturn($entity->getUsername());

$storage = new ObjectRepositoryStorage([
'objectRepository' => $objectRepository,
Expand Down

0 comments on commit 1640553

Please sign in to comment.