From a08aa08f4deeeb3a2a4e6fe74e31530958f4a34c Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 21 Oct 2021 13:14:57 +1300 Subject: [PATCH 1/2] API phpunit 9 support --- composer.json | 4 ++-- phpunit.xml.dist | 9 +++++---- tests/WidgetControllerTest.php | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 7803a75..294f844 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,12 @@ ], "require": { "silverstripe/vendor-plugin": "^1.0", - "silverstripe/framework": "^4.0", + "silverstripe/framework": "^4.10", "silverstripe/cms": "^4.0", "silverstripe/versioned": "^1.0" }, "require-dev": { - "sminnee/phpunit": "^5.7", + "phpunit/phpunit": "^9", "squizlabs/php_codesniffer": "^3.0" }, "extra": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f148411..6470738 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,9 @@ - - tests - - + + + tests + + src/ diff --git a/tests/WidgetControllerTest.php b/tests/WidgetControllerTest.php index cd0c1a1..b2de313 100644 --- a/tests/WidgetControllerTest.php +++ b/tests/WidgetControllerTest.php @@ -15,7 +15,7 @@ class WidgetControllerTest extends FunctionalTest TestWidget::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -32,7 +32,7 @@ public function testWidgetFormRendering() $response = $this->get($page->URLSegment); $formAction = sprintf('%s/widget/%d/%s', $page->URLSegment, $widget->ID, 'Form'); - $this->assertContains( + $this->assertStringContainsString( $formAction, $response->getBody(), "Widget forms are rendered through WidgetArea templates" @@ -47,12 +47,12 @@ public function testWidgetFormSubmission() $this->get($page->URLSegment); $response = $this->submitForm('Form_Form', null, array('TestValue' => 'Updated')); - $this->assertContains( + $this->assertStringContainsString( 'TestValue: Updated', $response->getBody(), "Form values are submitted to correct widget form" ); - $this->assertContains( + $this->assertStringContainsString( sprintf('Widget ID: %d', $widget->ID), $response->getBody(), "Widget form acts on correct widget, as identified in the URL" From 2b9536e5ae924153129380dca6a831e042615884 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 10 Nov 2021 10:47:55 +1300 Subject: [PATCH 2/2] DEP Use phpunit ^9.5 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 294f844..61e7d97 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "silverstripe/versioned": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^9", + "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3.0" }, "extra": { @@ -38,4 +38,4 @@ "license": "BSD-3-Clause", "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +}