Skip to content

Commit

Permalink
feat: support php 8.2 (dvsa/olcs-internal#165)
Browse files Browse the repository at this point in the history
* feat: Update to support php 8.2

* feat: Update to support php ^8.2

* feat!: reset phpunit execution order to random.

* feat!: delete rector.php util file

* Update composer.json

Co-authored-by: JoshuaLicense <JoshuaLicense@users.noreply.github.com>

* feat!: delete rector dependency

* feat!: delete rector dependency

---------

Co-authored-by: JoshuaLicense <JoshuaLicense@users.noreply.github.com>
  • Loading branch information
fibble and JoshuaLicense authored May 15, 2024
1 parent 3fba046 commit 7048770
Show file tree
Hide file tree
Showing 40 changed files with 756 additions and 727 deletions.
4 changes: 2 additions & 2 deletions app/internal/.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
2 changes: 1 addition & 1 deletion app/internal/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.0",
"ext-redis": "*",
"dvsa/laminas-config-cloud-parameters": "^0.2.0",
"laminas/laminas-authentication": "^2.5",
Expand Down
1,283 changes: 569 additions & 714 deletions app/internal/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
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
6 changes: 4 additions & 2 deletions app/internal/module/Olcs/src/Form/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

namespace Olcs\Form;

use Laminas\Form\Form;

/**
* Message Form
*
* @author Mat Evans <mat.evans@valtech.co.uk>
* @template-extends Form<mixed>
*/
class Message extends \Laminas\Form\Form
class Message extends Form
{
/**
* Set the message
Expand Down
17 changes: 14 additions & 3 deletions app/internal/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
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
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 app/internal/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
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
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
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
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
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 app/internal/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 app/internal/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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
class ConvictionsPenaltiesTest extends AbstractLvaFormServiceTestCase
{
protected $classToTest = ConvictionsPenalties::class;
protected $translator;
protected $urlHelper;
protected $classArgs;


public function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class FinancialHistoryTest extends MockeryTestCase
/** @var \Common\FormService\FormServiceManager */
protected $fsm;

protected $translator;


public function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class VariationFinancialEvidenceTest extends MockeryTestCase
/** @var m\MockInterface */
protected $translator;

public $validatorPluginManager;

public function setUp(): void
{
$this->formHelper = m::mock(\Common\Service\Helper\FormHelperService::class);
Expand Down
Loading

0 comments on commit 7048770

Please sign in to comment.