Skip to content

Commit

Permalink
phpcbf in app/test/ActorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbagg1 committed Nov 2, 2023
1 parent 2e86915 commit 09fdf4b
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public function setUp(): void
$this->form = new CreateNewActivationKey($guardProphecy->reveal());
}

/** @test */
/**
* @test
*/
public function it_defaults_to_false()
{
$this->assertEquals('no', $this->form->get('force_activation')->getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function setUp(): void
$this->form = new RequestReferenceNumber($this->guardProphecy->reveal(), true);
}

/** @test */
/**
* @test
*/
public function it_sets_correct_validator_when_flag_set_to_true(): void
{
$validators = $this->getForm()->getInputFilterSpecification()['opg_reference_number']['validators'];
Expand All @@ -63,7 +65,9 @@ public function it_sets_correct_validator_when_flag_set_to_true(): void
$this->assertStringContainsString($validators[$key]['name'], MerisReferenceCheckValidator::class);
}

/** @test */
/**
* @test
*/
public function it_sets_correct_validator_when_flag_set_to_false(): void
{
$this->form = new RequestReferenceNumber($this->guardProphecy->reveal(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ public function test_change_details_page_will_render_with_valid_actor_token()
);

$this->requestProphecy->getQueryParams()
->willReturn([
->willReturn(
[
'lpa' => self::LPA_ID,
]);
]
);

$this->templateRendererProphecy
->render('actor::change-details', [
->render(
'actor::change-details', [
'actorToken' => self::LPA_ID,
'user' => null,
])
]
)
->willReturn('');

$response = $handler->handle($this->requestProphecy->reveal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public function setUp(): void
->willReturn($httpClientProphecy->reveal());
}

/** @test */
/**
* @test
*/
public function testItCreatesASessionCheckHandler()
{
$this->containerProphecy->get('config')
Expand All @@ -64,7 +66,9 @@ public function testItCreatesASessionCheckHandler()
$this->assertInstanceOf(ActorSessionCheckHandler::class, $sessionCheckHandler);
}

/** @test */
/**
* @test
*/
public function testThrowsExceptionMissingConfigValue()
{
$this->containerProphecy->get('config')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class CheckLpaHandlerFactoryTest extends TestCase
{
use ProphecyTrait;

/** @test */
/**
* @test
*/
public function it_creates_a_correctly_configured_instance()
{
$rlsfProphecy = $this->prophesize(RateLimitServiceFactory::class);
Expand Down
16 changes: 9 additions & 7 deletions service-front/app/test/ActorTest/Handler/LpaAddHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ public function testGetReturnsHtmlResponse()

$this->rendererProphecy->render(
'actor::add-lpa/activation-key',
new CallbackToken(function ($options) {
$this->assertIsArray($options);
$this->assertArrayHasKey('form', $options);
$this->assertInstanceOf(ActivationKey::class, $options['form']);

return true;
})
new CallbackToken(
function ($options) {
$this->assertIsArray($options);
$this->assertArrayHasKey('form', $options);
$this->assertInstanceOf(ActivationKey::class, $options['form']);

return true;
}
)
)
->willReturn('');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public function it_can_be_created_empty(): void

/**
* @test
* @covers ::__construct
* @covers ::getActorRole
* @covers ::setActorRole
* @covers ::setActorAddressResponse
* @covers ::getActorAddressCheckResponse
* @covers ::__construct
* @covers ::getActorRole
* @covers ::setActorRole
* @covers ::setActorAddressResponse
* @covers ::getActorAddressCheckResponse
* @dataProvider fullActivationKeyWorkflow
*/
public function it_can_be_created_with_data(array $data): void
Expand All @@ -74,34 +74,34 @@ public function it_can_be_created_with_data(array $data): void

foreach ($data as $key => $value) {
switch ($key) {
case 'dob':
case 'donorDob':
Assert::assertInstanceOf(DateTimeInterface::class, $sut->$key);
Assert::assertEquals($value, $sut->$key->format('c'));
break;
case 'attorneyDob':
Assert::assertNull($sut->$key);
break;
case 'actorType':
Assert::assertEquals($data['actorType'], $sut->getActorRole());
break;
case 'actorAddressResponse':
Assert::assertEquals($data['actorAddressResponse'], $sut->getActorAddressCheckResponse());
break;
default:
Assert::assertEquals($value, $sut->$key);
case 'dob':
case 'donorDob':
Assert::assertInstanceOf(DateTimeInterface::class, $sut->$key);
Assert::assertEquals($value, $sut->$key->format('c'));
break;
case 'attorneyDob':
Assert::assertNull($sut->$key);
break;
case 'actorType':
Assert::assertEquals($data['actorType'], $sut->getActorRole());
break;
case 'actorAddressResponse':
Assert::assertEquals($data['actorAddressResponse'], $sut->getActorAddressCheckResponse());
break;
default:
Assert::assertEquals($value, $sut->$key);
}
}
}

/**
* @test
* @covers ::__construct
* @covers ::getActorRole
* @covers ::setActorRole
* @covers ::setActorAddressResponse
* @covers ::getActorAddressCheckResponse
* @covers ::reset
* @covers ::__construct
* @covers ::getActorRole
* @covers ::setActorRole
* @covers ::setActorAddressResponse
* @covers ::getActorAddressCheckResponse
* @covers ::reset
* @dataProvider fullActivationKeyWorkflow
*/
public function it_can_be_reset(array $data): void
Expand All @@ -114,23 +114,23 @@ public function it_can_be_reset(array $data): void

foreach ($data as $key => $value) {
switch ($key) {
case 'firstNames':
case 'lastName':
case 'postcode':
case 'dob':
Assert::assertNull($sut->$key);
break;
case 'actorType':
Assert::assertNull($sut->getActorRole());
break;
case 'actorAddressResponse':
Assert::assertNull($sut->getActorAddressCheckResponse());
break;
case 'needsCleansing':
Assert::assertFalse($sut->$key);
break;
default:
Assert::assertNull($sut->$key);
case 'firstNames':
case 'lastName':
case 'postcode':
case 'dob':
Assert::assertNull($sut->$key);
break;
case 'actorType':
Assert::assertNull($sut->getActorRole());
break;
case 'actorAddressResponse':
Assert::assertNull($sut->getActorAddressCheckResponse());
break;
case 'needsCleansing':
Assert::assertFalse($sut->$key);
break;
default:
Assert::assertNull($sut->$key);
}
}
}
Expand Down

0 comments on commit 09fdf4b

Please sign in to comment.