Skip to content

Commit

Permalink
Add unit test for OneLoginForm and fix failing api-app test
Browse files Browse the repository at this point in the history
  • Loading branch information
MishNajam committed Oct 25, 2023
1 parent 8445da0 commit b0a212b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ public function create_authorisation_request(): void
$authorisationRequestUrl = $authorisationRequest['url'];
$this->assertStringContainsString('client_id=client-id', $authorisationRequestUrl);
$this->assertStringContainsString('scope=openid+email', $authorisationRequestUrl);
$this->assertStringContainsString('vtr=%5B%22Cl.Cm.P2%22%5D', $authorisationRequestUrl);
$this->assertStringContainsString('vtr=["Cl.Cm.P2"]', urldecode($authorisationRequestUrl));
$this->assertStringContainsString('ui_locales=en', $authorisationRequestUrl);
$this->assertStringContainsString('redirect_uri=%2Flpa%2Fdashboard', $authorisationRequestUrl);
$this->assertStringContainsString(
'redirect_uri=http://localhost:9002/auth/redirect',
urldecode($authorisationRequestUrl)
);
}
}
38 changes: 38 additions & 0 deletions service-front/app/test/ActorTest/Form/OneLoginFormTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

declare(strict_types=1);

namespace ActorTest\Form;

use Actor\Form\OneLoginForm;
use Common\Form\AbstractForm;
use Common\Form\Element\Csrf;
use CommonTest\Form\LaminasFormTests;
use CommonTest\Form\TestsLaminasForm;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

class OneLoginFormTest extends TestCase implements TestsLaminasForm
{
use LaminasFormTests;
use ProphecyTrait;

protected OneLoginForm $form;

public function getForm(): AbstractForm
{
return $this->form;
}

public function getFormName(): string
{
return 'one_login';
}

public function getFormElements(): array
{
return [
'__csrf' => Csrf::class,
];
}
}

0 comments on commit b0a212b

Please sign in to comment.