diff --git a/composer.json b/composer.json index d10082c..6426f07 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ } ], "require": { - "silverstripe/framework": "^4.2", + "php": "^7.3 || ^8.0", + "silverstripe/framework": "^4.10", "colymba/gridfield-bulk-editing-tools": "^3.0.0-beta4" }, "suggest": { @@ -21,7 +22,7 @@ "silverstripe/cms": "The SilverStripe Content Management System" }, "require-dev": { - "sminnee/phpunit": "^5.7", + "phpunit/phpunit": "^9.5", "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/CommentingControllerTest.php b/tests/CommentingControllerTest.php index 68d642c..ec48e37 100644 --- a/tests/CommentingControllerTest.php +++ b/tests/CommentingControllerTest.php @@ -31,7 +31,7 @@ class CommentingControllerTest extends FunctionalTest protected $securityEnabled; - protected function tearDown() + protected function tearDown(): void { if ($this->securityEnabled) { SecurityToken::inst()->enable(); @@ -41,7 +41,7 @@ class CommentingControllerTest extends FunctionalTest parent::tearDown(); } - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->securityEnabled = SecurityToken::inst()->is_enabled(); @@ -194,7 +194,7 @@ class CommentingControllerTest extends FunctionalTest // specific page $response = $this->get('comments/rss/SilverStripe-Comments-Tests-Stubs-CommentableItem/'.$item->ID); $this->assertEquals(1, substr_count($response->getBody(), "")); - $this->assertContains('FA', $response->getBody()); + $this->assertStringContainsString('FA', $response->getBody()); // test accessing comments on a type that doesn't exist $response = $this->get('comments/rss/Fake'); diff --git a/tests/CommentsExtensionTest.php b/tests/CommentsExtensionTest.php index 5fc5226..87bcadb 100644 --- a/tests/CommentsExtensionTest.php +++ b/tests/CommentsExtensionTest.php @@ -32,7 +32,7 @@ class CommentsExtensionTest extends FunctionalTest ], ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -262,44 +262,44 @@ class CommentsExtensionTest extends FunctionalTest $item = $this->objFromFixture(CommentableItem::class, 'first'); // The comments form is HTML to do assertions by contains - $cf = $item->CommentsForm(); + $cf = (string) $item->CommentsForm(); $expected = '/comments/CommentsForm/" method="post" enctype="application/x-www-form-urlencoded">'; - $this->assertContains($expected, $cf); - $this->assertContains('

Post your comment

', $cf); + $this->assertStringContainsString($expected, $cf); + $this->assertStringContainsString('

Post your comment

', $cf); // check the comments form exists $expected = 'assertContains($expected, $cf); + $this->assertStringContainsString($expected, $cf); $expected = 'assertContains($expected, $cf); + $this->assertStringContainsString($expected, $cf); $expected = 'assertContains($expected, $cf); + $this->assertStringContainsString($expected, $cf); $expected = 'assertContains($expected, $cf); + $this->assertStringContainsString($expected, $cf); $expected = '