diff --git a/composer.json b/composer.json index 59d04741..c3ed73ac 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^7.1 || ^8.0", + "php": "^7.3 || ^8.0", + "silverstripe/framework": "^4.10@dev", "silverstripe/cms": "^4.7@dev", "silverstripe/admin": "^1.7@dev", "silverstripe/versioned": "^1.7@dev", @@ -26,7 +27,7 @@ "silverstripe/vendor-plugin": "^1" }, "require-dev": { - "silverstripe/recipe-testing": "1.x-dev" + "silverstripe/recipe-testing": "^2" }, "suggest": { "silverstripe/elemental-blocks": "Adds a set of common SilverStripe content block types", diff --git a/docs/en/advanced_setup.md b/docs/en/advanced_setup.md index eaf641c5..464f12da 100644 --- a/docs/en/advanced_setup.md +++ b/docs/en/advanced_setup.md @@ -300,7 +300,7 @@ TractorCow\Fluent\Model\Locale: In the case your fixture needs to contain data for only a single locale you can specify your desired locale in your unit test like this: ```php -protected function setUp() +protected function setUp(): void { // Set locale for fixture creation FluentState::singleton()->withState(function (FluentState $state) { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3e41eee8..0d087d59 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,9 @@ - - tests - - + + + tests + + src/ diff --git a/tests/BaseElementTest.php b/tests/BaseElementTest.php index d489509d..7d829c5a 100644 --- a/tests/BaseElementTest.php +++ b/tests/BaseElementTest.php @@ -107,7 +107,7 @@ public function testLink() { $element = $this->objFromFixture(ElementContent::class, 'content1'); - $this->assertContains($element->getPage()->Link(), $element->Link()); + $this->assertStringContainsString($element->getPage()->Link(), $element->Link()); } public function testGetEditLink() @@ -118,14 +118,14 @@ public function testGetEditLink() $element = $this->objFromFixture(ElementContent::class, 'content1'); $editLink = $element->getEditLink(); - $this->assertContains('http://example.com', $editLink, 'Link should be absolute'); - $this->assertContains('pages/edit', $editLink, 'Link should contain reference to the page'); + $this->assertStringContainsString('http://example.com', $editLink, 'Link should be absolute'); + $this->assertStringContainsString('pages/edit', $editLink, 'Link should contain reference to the page'); } public function testGetIcon() { $element = new ElementContent(); - $this->assertContains('class="font-icon-block-content"', $element->getIcon()); + $this->assertStringContainsString('class="font-icon-block-content"', $element->getIcon()); Config::modify()->set(ElementContent::class, 'icon', ''); $this->assertEmpty($element->getIcon()); diff --git a/tests/Behat/Context/FeatureContext.php b/tests/Behat/Context/FeatureContext.php index 9fc1995b..7c65ae36 100644 --- a/tests/Behat/Context/FeatureContext.php +++ b/tests/Behat/Context/FeatureContext.php @@ -3,6 +3,7 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Mink\Element\NodeElement; +use PHPUnit\Framework\Assert; use SilverStripe\BehatExtension\Context\BasicContext; use SilverStripe\BehatExtension\Context\SilverStripeContext; use SilverStripe\Framework\Tests\Behaviour\CmsFormsContext; @@ -43,10 +44,10 @@ public function iShouldSeeTheEditFormForBlock($negative, $position) $form = $block->find('css', '.element-editor-editform'); if ($iShouldNotSee) { - assertTrue(!$form || !$form->isVisible(), 'I see the form! Try again later.'); + Assert::assertTrue(!$form || !$form->isVisible(), 'I see the form! Try again later.'); } else { - assertNotNull($form, 'Edit form not found'); - assertTrue($form->isVisible()); + Assert::assertNotNull($form, 'Edit form not found'); + Assert::assertTrue($form->isVisible()); } } @@ -55,7 +56,7 @@ public function iShouldSeeTheEditFormForBlock($negative, $position) */ public function iShouldSeeAListOfBlocks() { - assertNotEmpty($this->getBlocks()); + Assert::assertNotEmpty($this->getBlocks()); } /** @@ -63,7 +64,7 @@ public function iShouldSeeAListOfBlocks() */ public function iShouldSeeAnEmptyListOfBlocks() { - assertEmpty($this->getBlocks()); + Assert::assertEmpty($this->getBlocks()); } /** @@ -71,7 +72,7 @@ public function iShouldSeeAnEmptyListOfBlocks() */ public function iShouldSeeBlock($position) { - assertNotNull($this->getSpecificBlock($position)); + Assert::assertNotNull($this->getSpecificBlock($position)); } /** @@ -80,7 +81,7 @@ public function iShouldSeeBlock($position) public function iClickOnBlock($position) { $block = $this->getSpecificBlock($position); - assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); $block->click(); } @@ -91,7 +92,7 @@ public function iClickOnTheCaretButtonForBlock($position) { $block = $this->getSpecificBlock($position); $button = $this->getCaretButton($block); - assertNotNull($button, 'Caret button for block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($button, 'Caret button for block ' . $position . ' was not found in the page.'); $button->click(); } @@ -102,7 +103,7 @@ public function iShouldSeeAsTheTitleForBlock($text, $position) { $block = $this->getSpecificBlock($position); $title = $block->find('css', '.element-editor-header__title'); - assertEquals($title->getText(), $text); + Assert::assertEquals($title->getText(), $text); } /** @@ -112,7 +113,7 @@ public function iShouldSeeAsTheSummaryForBlock($text, $position) { $block = $this->getSpecificBlock($position); $summary = $block->find('css', '.element-editor-summary__content'); - assertEquals($summary->getText(), $text); + Assert::assertEquals($summary->getText(), $text); } /** @@ -139,9 +140,9 @@ public function iShouldSeeThePublishButtonForBlock($negative, $position) $publishButton = $this->findPublishButton($position); if ($iShouldNotSee) { - assertNull($publishButton, 'Publish button displayed (but shouldn\'t)'); + Assert::assertNull($publishButton, 'Publish button displayed (but shouldn\'t)'); } else { - assertNotNull($publishButton, 'Publish button not displayed (but should be)'); + Assert::assertNotNull($publishButton, 'Publish button not displayed (but should be)'); } } @@ -158,9 +159,9 @@ public function iShouldSeeTheUnpublishButtonForBlock($negative, $position) $unpublishButton = $this->findUnpublishButton($position); if ($iShouldNotSee) { - assertNull($unpublishButton, 'Unpublish button displayed (but shouldn\'t)'); + Assert::assertNull($unpublishButton, 'Unpublish button displayed (but shouldn\'t)'); } else { - assertNotNull($unpublishButton, 'Unpublish button not displayed (but should be)'); + Assert::assertNotNull($unpublishButton, 'Unpublish button not displayed (but should be)'); } } @@ -172,7 +173,7 @@ public function iShouldSeeTheUnpublishButtonForBlock($negative, $position) public function iHoverOverBlock($position) { $block = $this->getSpecificBlock($position); - assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); $block->mouseOver(); } @@ -184,7 +185,7 @@ public function iHoverOverBlock($position) public function iHoverOverTheIconOfBlock($position) { $block = $this->getSpecificBlock($position); - assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); $icon = $block->find( 'css', '.element-editor-header .element-editor-header__info .element-editor-header__icon-container' @@ -204,7 +205,7 @@ public function stepIPressTheButtonInTheAddBlockPopover($text) // Selector preferable not font-icon, but other class shared among all buttons $button = $popover->find('css', '.font-icon-block-'. $blockType); - assertNotNull($button, "{$text} button not found in Add Block popover"); + Assert::assertNotNull($button, "{$text} button not found in Add Block popover"); $button->click(); } @@ -223,7 +224,7 @@ public function stepIPressTheButtonInTheActionMenuForBlock($buttonName, $blockNu $button = $popover->find('xpath', sprintf('/button[contains(text(), \'%s\')]', $buttonName)); - assertNotNull($button, sprintf('Could not find button labelled "%s"', $buttonName)); + Assert::assertNotNull($button, sprintf('Could not find button labelled "%s"', $buttonName)); $button->click(); } @@ -274,10 +275,10 @@ public function theFieldForBlockShouldContain($field, $blockNumber, $negate, $co public function iClickOnTheReport($reportName) { $reportsTable = $this->getSession()->getPage()->find('css', '.all-reports-gridfield .grid-field__table'); - assertNotNull($reportsTable, 'Report table could not be found'); + Assert::assertNotNull($reportsTable, 'Report table could not be found'); $report = $reportsTable->find('xpath', sprintf('//a[contains(text(), \'%s\')]', $reportName)); - assertNotNull($report, 'Specified report "' . $reportName . '" could not be found.'); + Assert::assertNotNull($report, 'Specified report "' . $reportName . '" could not be found.'); $report->click(); @@ -327,10 +328,10 @@ protected function getSpecificBlock($position) protected function getArchiveButton($position) { $block = $this->getSpecificBlock($position); - assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); $button = $block->find('css', '.element-editor__actions-archive'); - assertNotNull($button, 'Archive button not found'); + Assert::assertNotNull($button, 'Archive button not found'); return $button; } @@ -344,7 +345,7 @@ protected function getArchiveButton($position) protected function findPublishButton($position) { $block = $this->getSpecificBlock($position); - assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); $button = $block->find('css', '.element-editor__actions-publish'); @@ -360,7 +361,7 @@ protected function findPublishButton($position) protected function findUnpublishButton($position) { $block = $this->getSpecificBlock($position); - assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); + Assert::assertNotNull($block, 'Block ' . $position . ' was not found in the page.'); $button = $block->find('css', '.element-editor__actions-unpublish'); @@ -376,7 +377,7 @@ protected function findUnpublishButton($position) protected function getCaretButton($block) { $button = $block->find('css', '.element-editor-header__expand'); - assertNotNull($button, 'Caret button not found'); + Assert::assertNotNull($button, 'Caret button not found'); return $button; } @@ -390,8 +391,8 @@ protected function findFieldInBlock($block, $name) { $label = $block->findAll('xpath', sprintf('//label[contains(text(), \'%s\')]', $name)); - assertNotCount(0, $label, sprintf('Could not find a label for a field with the content "%s"', $name)); - assertCount( + Assert::assertNotCount(0, $label, sprintf('Could not find a label for a field with the content "%s"', $name)); + Assert::assertCount( 1, $label, sprintf( @@ -405,7 +406,7 @@ protected function findFieldInBlock($block, $name) $fieldId = $label->getAttribute('for'); $field = $block->find('css', '#' . $fieldId); - assertNotNull($field, sprintf( + Assert::assertNotNull($field, sprintf( 'Label found matching "%s" but there was no field that has the ID matching the "for" attribute ("#%s")', $name, $fieldId diff --git a/tests/ElementControllerTest.php b/tests/ElementControllerTest.php index d26fc867..2ef2b0e8 100644 --- a/tests/ElementControllerTest.php +++ b/tests/ElementControllerTest.php @@ -26,7 +26,7 @@ class ElementControllerTest extends FunctionalTest TestElement::class ]; - protected function setUp() + protected function setUp(): void { Versioned::set_stage(Versioned::DRAFT); @@ -40,6 +40,6 @@ public function testForTemplate() $this->logInWithPermission('ADMIN'); $controller = new TestElementController($element); - $this->assertContains('Hello Test', $controller->forTemplate()); + $this->assertStringContainsString('Hello Test', $controller->forTemplate()); } } diff --git a/tests/ElementalAreaTest.php b/tests/ElementalAreaTest.php index 91edd828..f5949cce 100644 --- a/tests/ElementalAreaTest.php +++ b/tests/ElementalAreaTest.php @@ -85,8 +85,8 @@ public function testForTemplate() { $area = $this->objFromFixture(ElementalArea::class, 'area1'); - $this->assertContains('Hello Test', $area->forTemplate()); - $this->assertContains('Hello Test 2', $area->forTemplate()); + $this->assertStringContainsString('Hello Test', $area->forTemplate()); + $this->assertStringContainsString('Hello Test 2', $area->forTemplate()); } public function testCanBePublished() diff --git a/tests/ElementalPageExtensionTest.php b/tests/ElementalPageExtensionTest.php index b046bcb0..7ea2205e 100644 --- a/tests/ElementalPageExtensionTest.php +++ b/tests/ElementalPageExtensionTest.php @@ -26,7 +26,7 @@ class ElementalPageExtensionTest extends FunctionalTest TestPage::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/Extensions/ElementalAreasExtensionTest.php b/tests/Extensions/ElementalAreasExtensionTest.php index 97752fc7..ab47825d 100644 --- a/tests/Extensions/ElementalAreasExtensionTest.php +++ b/tests/Extensions/ElementalAreasExtensionTest.php @@ -25,7 +25,7 @@ class ElementalAreasExtensionTest extends SapphireTest TestUnusedElement::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/Forms/ElementalAreaFieldTest.php b/tests/Forms/ElementalAreaFieldTest.php index b2b20195..58141a6e 100644 --- a/tests/Forms/ElementalAreaFieldTest.php +++ b/tests/Forms/ElementalAreaFieldTest.php @@ -23,7 +23,7 @@ class ElementalAreaFieldTest extends SapphireTest */ protected $field; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/Forms/TextCheckboxGroupFieldTest.php b/tests/Forms/TextCheckboxGroupFieldTest.php index fa7d6d5c..820f1395 100644 --- a/tests/Forms/TextCheckboxGroupFieldTest.php +++ b/tests/Forms/TextCheckboxGroupFieldTest.php @@ -15,7 +15,7 @@ class TextCheckboxGroupFieldTest extends SapphireTest */ protected $field; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/GraphQL/AddElementToAreaMutationTest.php b/tests/GraphQL/AddElementToAreaMutationTest.php index c4eda5e6..5504074d 100644 --- a/tests/GraphQL/AddElementToAreaMutationTest.php +++ b/tests/GraphQL/AddElementToAreaMutationTest.php @@ -18,7 +18,7 @@ class AddElementToAreaMutationTest extends SapphireTest TestElement::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); if (!class_exists(Schema::class)) { @@ -50,20 +50,16 @@ public function testAddingBlocksInOrder() $this->assertIdsInOrder([$five, $one, $three, $two, $four], 'The fifth element is added first, after ID 0'); } - /** - * @expectedException InvalidArgumentException - */ public function testBadElementalArea() { + $this->expectException(InvalidArgumentException::class); $areaID = $this->objFromFixture(ElementalArea::class, 'one')->ID; $this->runMutation(TestElement::class, $areaID + 1); } - /** - * @expectedException InvalidArgumentException - */ public function testOrderingByWrongElementalArea() { + $this->expectException(InvalidArgumentException::class); $firstArea = ElementalArea::get()->first(); $elementInFirstArea = TestElement::create(); $firstArea->Elements()->add($elementInFirstArea); diff --git a/tests/GraphQL/DuplicateElementMutationTest.php b/tests/GraphQL/DuplicateElementMutationTest.php index 3a61a487..38368e7f 100644 --- a/tests/GraphQL/DuplicateElementMutationTest.php +++ b/tests/GraphQL/DuplicateElementMutationTest.php @@ -12,7 +12,7 @@ class DuplicateElementMutationTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); if (!class_exists(Schema::class)) { diff --git a/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php b/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php index 8755f520..fe83dbb6 100644 --- a/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php +++ b/tests/GraphQL/Legacy/AddElementToAreaMutationTest.php @@ -19,7 +19,7 @@ class AddElementToAreaMutationTest extends SapphireTest TestElement::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); if (class_exists(Schema::class)) { @@ -51,20 +51,16 @@ public function testAddingBlocksInOrder() $this->assertIdsInOrder([$five, $one, $three, $two, $four], 'The fifth element is added first, after ID 0'); } - /** - * @expectedException InvalidArgumentException - */ public function testBadElementalArea() { + $this->expectException(InvalidArgumentException::class); $areaID = $this->objFromFixture(ElementalArea::class, 'one')->ID; $this->runMutation(TestElement::class, $areaID + 1); } - /** - * @expectedException InvalidArgumentException - */ public function testOrderingByWrongElementalArea() { + $this->expectException(InvalidArgumentException::class); $firstArea = ElementalArea::get()->first(); $elementInFirstArea = TestElement::create(); $firstArea->Elements()->add($elementInFirstArea); diff --git a/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php b/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php index 4ea6c37b..fb8a7b03 100644 --- a/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php +++ b/tests/GraphQL/Legacy/SortBlockMutationCreatorTest.php @@ -17,7 +17,7 @@ class SortBlockMutationCreatorTest extends SapphireTest TestElement::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); if (class_exists(Schema::class)) { diff --git a/tests/GraphQL/SortBlockMutationCreatorTest.php b/tests/GraphQL/SortBlockMutationCreatorTest.php index d474d3af..8c50499c 100644 --- a/tests/GraphQL/SortBlockMutationCreatorTest.php +++ b/tests/GraphQL/SortBlockMutationCreatorTest.php @@ -16,7 +16,7 @@ class SortBlockMutationCreatorTest extends SapphireTest TestElement::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); if (!class_exists(Schema::class)) { diff --git a/tests/Reports/ElementsInUseReportTest.php b/tests/Reports/ElementsInUseReportTest.php index bb52a274..2f22432e 100644 --- a/tests/Reports/ElementsInUseReportTest.php +++ b/tests/Reports/ElementsInUseReportTest.php @@ -27,7 +27,7 @@ class ElementsInUseReportTest extends FunctionalTest TestPage::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -37,7 +37,7 @@ protected function setUp() } } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); @@ -53,18 +53,18 @@ public function testReportShowsElementsInUse() $result = (string) $this->get('admin/reports/show/DNADesign-Elemental-Reports-ElementsInUseReport')->getBody(); - $this->assertContains('Content blocks in use', $result, 'Title is displayed'); + $this->assertStringContainsString('Content blocks in use', $result, 'Title is displayed'); - $this->assertContains( + $this->assertStringContainsString( 'data-class="DNADesign\\Elemental\\Models\\ElementContent"', $result, 'Report contains content elements (bundled with elemental)' ); - $this->assertContains('HTML text block', $result, 'Content element "nice" type is shown'); + $this->assertStringContainsString('HTML text block', $result, 'Content element "nice" type is shown'); - $this->assertContains('My special content block', $result, 'Fixtured content element is shown'); - $this->assertContains('Stubby Stub', $result, 'Fixtured stub element is shown'); + $this->assertStringContainsString('My special content block', $result, 'Fixtured content element is shown'); + $this->assertStringContainsString('Stubby Stub', $result, 'Fixtured stub element is shown'); } public function testSourceRecords() @@ -87,7 +87,7 @@ public function testElementsAssociatedToPagesHaveEditLink() $castros = $records->first(); $this->assertNotNull($castros, 'Fixtured Castros page exists'); $this->assertTrue($castros->hasField('EditLink')); - $this->assertContains( + $this->assertStringContainsString( (string) $this->idFromFixture(TestPage::class, 'castros_home'), $castros->EditLink, 'Correct owner page ID is in edit link' diff --git a/tests/Services/ElementTabProviderTest.php b/tests/Services/ElementTabProviderTest.php index 05a53047..aa24d185 100644 --- a/tests/Services/ElementTabProviderTest.php +++ b/tests/Services/ElementTabProviderTest.php @@ -6,7 +6,7 @@ class ElementTabProviderTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->markTestIncomplete('Does not yet test anything, remains to be implemented'); diff --git a/tests/Tasks/MigrateContentToElementTest.php b/tests/Tasks/MigrateContentToElementTest.php index 08d32a0a..9615430a 100644 --- a/tests/Tasks/MigrateContentToElementTest.php +++ b/tests/Tasks/MigrateContentToElementTest.php @@ -27,7 +27,7 @@ class MigrateContentToElementTest extends SapphireTest TestPage::class, ]; - protected function setUp() + protected function setUp(): void { TestPage::create()->flushCache(); parent::setUp(); @@ -46,7 +46,7 @@ public function testContentIsMigratedFromPagesToNewElements() $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 1 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 1 pages\' content', $output); // Get the page that should've been updated and the content should be removed $page = $this->objFromFixture(TestPage::class, 'page3'); @@ -76,20 +76,20 @@ public function testContentIsNotClearedWhenConfigured() $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 1 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 1 pages\' content', $output); $page = $this->objFromFixture(TestPage::class, 'page3'); - $this->assertContains('This is page 3', $page->Content, 'Content is not removed from the page'); + $this->assertStringContainsString('This is page 3', $page->Content, 'Content is not removed from the page'); $element = $page->ElementalArea->Elements()->first(); - $this->assertContains('This is page 3', $element->HTML, 'Content is still added to a new element'); + $this->assertStringContainsString('This is page 3', $element->HTML, 'Content is still added to a new element'); // Run the task again and assert the page is not picked up again ob_start(); $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 0 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 0 pages\' content', $output); $page = $this->objFromFixture(TestPage::class, 'page3'); $this->assertCount(1, $page->ElementalArea->Elements()); } @@ -105,7 +105,7 @@ public function testTargetElementConfigurationIsRespected() $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 1 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 1 pages\' content', $output); // Get the page that should've been updated and the content should be removed $element = $this->objFromFixture(TestPage::class, 'page3')->ElementalArea->Elements()->first(); @@ -129,7 +129,7 @@ public function testPublishingConfigurationIsRespected() $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 1 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 1 pages\' content', $output); // Get the page that should've been updated and the content should be removed $page = $this->objFromFixture(TestPage::class, 'page3'); @@ -156,7 +156,7 @@ public function testPagesThatWereNotPublishedAreNotPublishedDuringThisTask() $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 1 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 1 pages\' content', $output); // Get the page that should've been updated and the content should be removed /** @var TestPage&Versioned $page */ @@ -191,7 +191,7 @@ public function testIgnoredClassesContentIsNotCleared() $task->run(new HTTPRequest('GET', '')); $output = ob_get_clean(); - $this->assertContains('Finished migrating 0 pages\' content', $output); + $this->assertStringContainsString('Finished migrating 0 pages\' content', $output); // Get the page and confirm its content has not been altered. $page = $this->objFromFixture(TestPage::class, 'page3');