Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
feat: Update to support php 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fibble committed May 13, 2024
1 parent 9d40fb4 commit 201766c
Show file tree
Hide file tree
Showing 42 changed files with 880 additions and 728 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
static-analysis:
uses: dvsa/.github/.github/workflows/php-static.yml@main
with:
php-version: '8.0'
php-version: '8.2'

tests:
uses: dvsa/.github/.github/workflows/php-tests.yml@main
with:
php-versions: "[\"8.0\"]"
php-versions: "[\"8.2\"]"
fail-fast: false
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "https://github.com/dvsa/laminas-form.git"
}],
"require": {
"php": "~8.0.0",
"php": "^8.2",
"ext-redis": "*",
"dvsa/laminas-config-cloud-parameters": "^0.2.0",
"laminas/laminas-authentication": "^2.5",
Expand Down Expand Up @@ -50,7 +50,8 @@
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^9.6",
"san/san-session-toolbar": "*",
"bamarni/composer-bin-plugin": "^1.8"
"bamarni/composer-bin-plugin": "^1.8",
"rector/rector": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
1,400 changes: 686 additions & 714 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ class OperatorIrfoGvPermitsController extends AbstractInternalController impleme
protected $tableName = 'operator.irfo.gv-permits';
protected $listDto = ListDto::class;
protected $listVars = ['organisation'];
private Permission $permissionService;


public function __construct(
TranslationHelperService $translationHelperService,
FormHelperService $formHelperService,
FlashMessengerHelperService $flashMessengerHelperService,
Navigation $navigation,
Permission $permissionService
private Permission $permissionService
) {
$this->permissionService = $permissionService;
parent::__construct($translationHelperService, $formHelperService, $flashMessengerHelperService, $navigation);
}

Expand Down
2 changes: 1 addition & 1 deletion module/Olcs/src/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function searchAction()

$searchIndex = $elasticSearch->getSearchData()['index'];
if (!$this->canAccessSearchIndex($searchIndex)) {
throw new UnauthorizedException("User not allowed to access ${searchIndex} search index");
throw new UnauthorizedException("User not allowed to access {$searchIndex} search index");
}

$this->loadScripts(['table-actions']);
Expand Down
2 changes: 1 addition & 1 deletion module/Olcs/src/Form/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Message Form
*
* @author Mat Evans <mat.evans@valtech.co.uk>
* @template-extends Form<mixed>
*/
class Message extends \Laminas\Form\Form

Check failure on line 10 in module/Olcs/src/Form/Message.php

View workflow job for this annotation

GitHub Actions / static-analysis / Psalm - 8.2

MissingTemplateParam

module/Olcs/src/Form/Message.php:10:7: MissingTemplateParam: Olcs\Form\Message has missing template params when extending Laminas\Form\Form, expecting 1 (see https://psalm.dev/182)
{
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="true"
colors="true"
executionOrder="random"
executionOrder="default"
convertWarningsToExceptions="false"
>
<php>
Expand Down
7 changes: 7 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPaths([__DIR__ . '/module', __DIR__ . '/test'])
->withPhpSets(php82: true);
17 changes: 14 additions & 3 deletions test/Olcs/src/Controller/Auth/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@

class LoginControllerTest extends MockeryTestCase
{
protected $authenticationAdapter;
protected $authenticationService;
protected $currentUser;
protected $flashMessenger;
protected $formHelper;
protected $layout;
protected $redirectHelper;
protected $url;
protected $authChallengeContainer;


public const EMPTY_FORM_DATA = [
'username' => null,
'password' => null,
Expand Down Expand Up @@ -135,7 +146,7 @@ public function indexActionReturnsViewModel()

/**
* @test
* @depends indexAction_ReturnsViewModel
* @depends indexActionReturnsViewModel
*/
public function indexActionReturnsViewModelWithLoginForm()
{
Expand All @@ -158,7 +169,7 @@ public function indexActionReturnsViewModelWithLoginForm()

/**
* @test
* @depends indexAction_ReturnsViewModel
* @depends indexActionReturnsViewModel
*/
public function indexActionReturnsViewModelWithFailureReasonWhenAuthenticationFails()
{
Expand Down Expand Up @@ -264,7 +275,7 @@ public function postActionFlashesFormDataWhenFormInvalid()

/**
* @test
* @depends postAction_IsCallable
* @depends postActionIsCallable
*/
public function postActionSuccessfulCognitoAuthRedirectsToDashboard()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
class BusDetailsControllerTest extends MockeryTestCase
{
protected $sut;
protected $translationHelper;
protected $formHelper;
protected $flashMessengerHelper;
protected $navigation;

public function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
*/
class BusProcessingRegistrationHistoryControllerTest extends MockeryTestCase
{
protected $sut;
protected $translationHelper;
protected $formHelper;
protected $flashMessengerHelper;
protected $navigation;
protected $pluginManagerHelper;

public function setUp(): void
{
$this->pluginManagerHelper = new ControllerPluginManagerHelper();
Expand Down
4 changes: 4 additions & 0 deletions test/Olcs/src/Controller/Bus/Short/BusShortControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
class BusShortControllerTest extends MockeryTestCase
{
protected $sut;
protected $translationHelper;
protected $formHelper;
protected $flashMessengerHelper;
protected $navigation;

public function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ class OppositionControllerTest extends MockeryTestCase
*/
protected $pluginManagerHelper;

protected $sut;

protected $translationHelper;

protected $formHelper;

protected $flashMessengerHelper;

protected $navigation;

protected $routeMatchHelper;

public function setUp(): void
{

Expand Down
5 changes: 5 additions & 0 deletions test/Olcs/src/Controller/DisqualifyControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
class DisqualifyControllerTest extends MockeryTestCase
{
protected $sut;
protected $mockScriptFactory;
protected $mockFormHelper;
protected $mockTableFactory;
protected $mockViewHelperManager;
protected $mockFlashMessengerHelper;

protected function setUp(): void
{
Expand Down
18 changes: 18 additions & 0 deletions test/Olcs/src/Controller/IndexControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ class IndexControllerTest extends MockeryTestCase

protected $sm;

protected $mockScriptFactory;
protected $mockFormHelper;
protected $mockTableFactory;
protected $mockViewHelperManager;
protected $mockFlashMessengerHelper;
protected $mockUserListInternalDataService;
protected $mockUserListInternalExcludingDataService;
protected $mockSubCategoryDataService;
protected $mockTaskSubCategoryDataService;
protected $mockDocumentSubCategoryDataService;
protected $mockDocumentSubCategoryWithDocsDataService;
protected $mockScannerSubCategoryDataService;
protected $mockSubCategoryDescriptionDataService;
protected $mockIrhpPermitPrintCountryDataService;
protected $mockIrhpPermitPrintStockDataService;
protected $mockIrhpPermitPrintRangeTypeDataService;


public function setUp(): void
{
$this->mockScriptFactory = m::mock(ScriptFactory::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
*/
class ContinuationControllerTest extends AbstractLvaControllerTestCase
{
protected $sut;
protected $mockScriptFactory;
protected $mockFormHelper;
protected $mockTableFactory;
protected $mockViewHelperManager;
protected $mockFlashMessengerHelper;
protected $mockLessThanValidator;

public function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
*/
class LicenceProcessingOverviewControllerTest extends \PHPUnit\Framework\TestCase
{
protected $mockScriptFactory;
protected $mockFormHelper;
protected $mockTableFactory;
protected $mockViewHelperManager;
protected $mockOppositionHelper;
protected $mockComplaintsHelper;
protected $mockNavigation;
protected $mockSubCategoryDataService;
protected $mockFlashMessenger;
protected $mockRouter;

public function testIndexActionRedirects()
{
$controller = $this->getController('index');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ class ConditionsUndertakingsControllerTest extends AbstractLvaControllerTestCase
{
protected $sut;

protected $mockNiTextTranslationUtil;

protected $mockAuthService;

protected $mockFormHelper;

protected $mockFlashMessengerHelper;

protected $mockFormServiceManager;

protected $mockTableFactory;

protected $mockStringHelper;

protected $mockLvaAdapter;

protected $mockRestrictionHelper;

protected $mockNavigation;


public function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
*/
class OverviewControllerTest extends AbstractLvaControllerTestCase
{
protected $mockNiTextTranslationUtil;
protected $mockAuthService;
protected $mockLicenceOverviewHelper;
protected $mockFormHelper;
protected $mockNavigation;
protected $mockFlashMessenger;

public function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class VariationControllerTraitTest extends MockeryTestCase
{
protected $sut;
protected $sm;
protected $mockNiTextTranslationUtil;
protected $mockAuthService;
protected $mockStringHelper;


public function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
*/
class LicenceEnableDisableMessagingControllerTest extends AbstractLvaControllerTestCase
{
protected $mockNavigation;
protected $mockScriptFactory;
protected $mockFormHelper;
protected $mockTableFactory;
protected $mockViewHelperManager;
protected $mockFlashMessengerHelper;
protected $mockDataServiceManager;
protected $mockOppositionHelper;
protected $mockComplaintsHelper;

public function setUp(): void
{
parent::setUp();
Expand Down
1 change: 1 addition & 0 deletions test/Olcs/src/Controller/SplitScreenControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class SplitScreenControllerTest extends MockeryTestCase
{
protected $sut;
protected $mockScriptFactory;

public function setUp(): void
{
Expand Down
3 changes: 3 additions & 0 deletions test/Olcs/src/Controller/Traits/DocumentSearchTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
class DocumentSearchTraitTest extends MockeryTestCase
{
protected $mockFormHelper;
protected $docSubCategoryDataService;

public const CAT_ID = 8001;

/** @var Stub\StubDocumentSearchTrait */
Expand Down
3 changes: 3 additions & 0 deletions test/Olcs/src/Controller/Traits/TaskSearchTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class TaskSearchTraitTest extends MockeryTestCase

/** @var \OlcsTest\Controller\Traits\Stub\StubTaskSearchTrait */
private $sut;
protected $mockFormHelper;
protected $mockSubCategoryDataService;
protected $mockForm;

public function setUp(): void
{
Expand Down
2 changes: 2 additions & 0 deletions test/Olcs/src/Data/Mapper/IrhpApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class IrhpApplicationTest extends MockeryTestCase
{
private $applicationStepsPostDataTransformer;

protected $sut;

public function setUp(): void
{
$this->applicationStepsPostDataTransformer = m::mock(ApplicationStepsPostDataTransformer::class);
Expand Down
2 changes: 2 additions & 0 deletions test/Olcs/src/Data/Mapper/IrhpPermitApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
class IrhpPermitApplicationTest extends MockeryTestCase
{
protected $sut;

public function setUp(): void
{
$this->sut = new \Olcs\Data\Mapper\IrhpPermitApplication();
Expand Down
2 changes: 2 additions & 0 deletions test/Olcs/src/Data/Mapper/IrhpPermitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
class IrhpPermitTest extends MockeryTestCase
{
protected $sut;

public function setUp(): void
{
$this->sut = new \Olcs\Data\Mapper\IrhpPermit();
Expand Down
2 changes: 2 additions & 0 deletions test/Olcs/src/Data/Mapper/OperatorPeopleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
class OperatorPeopleTest extends MockeryTestCase
{
protected $sut;

public function setUp(): void
{
$this->sut = new \Olcs\Data\Mapper\OperatorPeople();
Expand Down
Loading

0 comments on commit 201766c

Please sign in to comment.