mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2694 from creative-commoners/pulls/4/sapphire-test-nine
API phpunit9 support
This commit is contained in:
commit
e7c49faab2
@ -21,15 +21,15 @@
|
||||
"require": {
|
||||
"silverstripe/admin": "^1.9@dev",
|
||||
"silverstripe/campaign-admin": "^1.7@dev",
|
||||
"silverstripe/framework": "^4.7@dev",
|
||||
"silverstripe/framework": "^4.10",
|
||||
"silverstripe/reports": "^4.7@dev",
|
||||
"silverstripe/siteconfig": "^4.7@dev",
|
||||
"silverstripe/versioned": "^1.7@dev",
|
||||
"silverstripe/vendor-plugin": "^1.0",
|
||||
"php": "^7.1 || ^8"
|
||||
"php": "^7.3 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"sminnee/phpunit": "^5.7",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"squizlabs/php_codesniffer": "^3"
|
||||
},
|
||||
"extra": {
|
||||
|
@ -1,9 +1,9 @@
|
||||
<phpunit bootstrap="tests/bootstrap.php" colors="true">
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Default">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">.</directory>
|
||||
|
@ -5,6 +5,7 @@ namespace SilverStripe\CMS\Tests\Behaviour;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use Behat\Mink\Element\DocumentElement;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use SilverStripe\BehatExtension\Context\BasicContext;
|
||||
use SilverStripe\BehatExtension\Context\FixtureContext as BehatFixtureContext;
|
||||
use SilverStripe\CMS\Model\RedirectorPage;
|
||||
@ -90,7 +91,7 @@ class FixtureContext extends BehatFixtureContext
|
||||
$page = $this->getMainContext()->getSession()->getPage();
|
||||
$element = $page->find('css', $selector);
|
||||
|
||||
assertNotNull($element, sprintf('Element %s not found', $selector));
|
||||
Assert::assertNotNull($element, sprintf('Element %s not found', $selector));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +110,7 @@ class FixtureContext extends BehatFixtureContext
|
||||
'radio',
|
||||
$this->getMainContext()->getXpathEscaper()->escapeLiteral($radioLabel)
|
||||
]);
|
||||
assertNotNull($radioButton);
|
||||
assertEquals($value, $radioButton->getAttribute($attribute));
|
||||
Assert::assertNotNull($radioButton);
|
||||
Assert::assertEquals($value, $radioButton->getAttribute($attribute));
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace SilverStripe\CMS\Tests\Behaviour;
|
||||
|
||||
use Page;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use SilverStripe\BehatExtension\Context\LoginContext as BehatLoginContext;
|
||||
|
||||
class LoginContext extends BehatLoginContext
|
||||
@ -20,16 +21,16 @@ class LoginContext extends BehatLoginContext
|
||||
{
|
||||
// Reset permission cache
|
||||
$page = Page::get()->First();
|
||||
assertNotNull($page, 'A page exists');
|
||||
Assert::assertNotNull($page, 'A page exists');
|
||||
$email = "{$permCode}@example.org";
|
||||
$password = 'Password!456';
|
||||
$member = $this->generateMemberWithPermission($email, $password, $permCode);
|
||||
$canEdit = strstr($negative, 'not') ? false : true;
|
||||
|
||||
if ($canEdit) {
|
||||
assertTrue($page->canEdit($member), 'The member can edit this page');
|
||||
Assert::assertTrue($page->canEdit($member), 'The member can edit this page');
|
||||
} else {
|
||||
assertFalse($page->canEdit($member), 'The member cannot edit this page');
|
||||
Assert::assertFalse($page->canEdit($member), 'The member cannot edit this page');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class CMSBatchActionsTest extends SapphireTest
|
||||
|
||||
protected static $fixture_file = 'CMSBatchActionsTest.yml';
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class CMSMainTest extends FunctionalTest
|
||||
|
||||
protected static $orig = [];
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -128,7 +128,7 @@ class CMSMainTest extends FunctionalTest
|
||||
$this->logInAs('admin');
|
||||
|
||||
$response = $this->get('admin/pages/publishall?confirm=1');
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
'Done: Published 30 pages',
|
||||
$response->getBody()
|
||||
);
|
||||
@ -218,7 +218,7 @@ class CMSMainTest extends FunctionalTest
|
||||
$this->assertTrue($livePage->canDelete());
|
||||
|
||||
// Check that the 'restore' button exists as a simple way of checking that the correct page is returned.
|
||||
$this->assertRegExp('/<button type="submit"[^>]+name="action_(restore|revert)"/i', $response->getBody());
|
||||
$this->assertMatchesRegularExpression('/<button type="submit"[^>]+name="action_(restore|revert)"/i', $response->getBody());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -306,7 +306,7 @@ class CMSMainTest extends FunctionalTest
|
||||
|
||||
$location = $response->getHeader('X-ControllerURL');
|
||||
$this->assertNotEmpty($location, 'Must be a redirect on success');
|
||||
$this->assertContains('/show/', $location, 'Must redirect to /show/ the new page');
|
||||
$this->assertStringContainsString('/show/', $location, 'Must redirect to /show/ the new page');
|
||||
$this->logOut();
|
||||
|
||||
$this->autoFollowRedirection = $origFollow;
|
||||
|
@ -28,7 +28,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
CMSPageHistoryControllerTest\HistoryController::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -73,7 +73,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
$this->assertEquals($this->page->ID, $form->Fields()->dataFieldByName('ID')->Value());
|
||||
$this->assertEquals($this->versionPublishCheck2, $form->Fields()->dataFieldByName('Version')->Value());
|
||||
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
'Currently viewing the latest version',
|
||||
$form->Fields()->fieldByName('Root.Main.CurrentlyViewingMessage')->getContent()
|
||||
);
|
||||
@ -84,19 +84,19 @@ class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
|
||||
$this->assertEquals($this->page->ID, $form->Fields()->dataFieldByName('ID')->Value());
|
||||
$this->assertEquals($this->versionPublishCheck, $form->Fields()->dataFieldByName('Version')->Value());
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
sprintf("Currently viewing version %s.", $this->versionPublishCheck),
|
||||
$form->Fields()->fieldByName('Root.Main.CurrentlyViewingMessage')->getContent()
|
||||
);
|
||||
|
||||
// check that compare mode updates the message
|
||||
$form = $controller->getEditForm($this->page->ID, null, $this->versionPublishCheck, $this->versionPublishCheck2);
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
sprintf("Comparing versions %s", $this->versionPublishCheck),
|
||||
$form->Fields()->fieldByName('Root.Main.CurrentlyViewingMessage')->getContent()
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
sprintf("and %s", $this->versionPublishCheck2),
|
||||
$form->Fields()->fieldByName('Root.Main.CurrentlyViewingMessage')->getContent()
|
||||
);
|
||||
@ -142,12 +142,12 @@ class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
$i = 0;
|
||||
foreach ($rows as $tr) {
|
||||
// data-link must be present for the javascript to load new
|
||||
$this->assertContains($expected[$i]['status'], (string) $tr->attributes()->class);
|
||||
$this->assertStringContainsString($expected[$i]['status'], (string) $tr->attributes()->class);
|
||||
$i++;
|
||||
}
|
||||
|
||||
// test highlighting
|
||||
$this->assertContains('active', (string) $rows[0]->attributes()->class);
|
||||
$this->assertStringContainsString('active', (string) $rows[0]->attributes()->class);
|
||||
$this->assertThat((string) $rows[1]->attributes()->class, $this->logicalNot($this->stringContains('active')));
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
$checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished');
|
||||
|
||||
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
|
||||
$checked = $checkbox[0]->attributes()->checked;
|
||||
$checked = $checkbox[0]->attributes()->checked ?: '';
|
||||
|
||||
$this->assertThat($checked, $this->logicalNot($this->stringContains('checked')));
|
||||
|
||||
@ -187,7 +187,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
|
||||
$field = $newList->dataFieldByName('field');
|
||||
$this->assertTrue($field instanceof HTMLReadonlyField);
|
||||
$this->assertContains('<ins>', $field->forTemplate());
|
||||
$this->assertStringContainsString('<ins>', $field->forTemplate());
|
||||
|
||||
$groupField = $newList->fieldByName('group');
|
||||
$this->assertTrue($groupField instanceof FieldGroup);
|
||||
|
@ -39,7 +39,7 @@ class ContentControllerPermissionsTest extends FunctionalTest
|
||||
}
|
||||
// should redirect to login
|
||||
$this->assertEquals($response->getStatusCode(), 302, 'Redirects to login page when not logged in for draft stage');
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
Config::inst()->get('SilverStripe\\Security\\Security', 'login_url'),
|
||||
$response->getHeader('Location')
|
||||
);
|
||||
|
@ -31,7 +31,7 @@ class ContentControllerSearchExtensionTest extends SapphireTest
|
||||
$this->assertEquals([ File::class ], $form->getClassesToSearch());
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
FulltextSearchable::enable(File::class);
|
||||
@ -42,7 +42,7 @@ class ContentControllerSearchExtensionTest extends SapphireTest
|
||||
* properly at the end of the test. This becomes apparent when a later test tries to
|
||||
* ALTER TABLE File and add fulltext indexes with the InnoDB table type.
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
File::remove_extension(FulltextSearchable::class);
|
||||
parent::tearDownAfterClass();
|
||||
|
@ -24,7 +24,7 @@ class ContentControllerTest extends FunctionalTest
|
||||
ContentControllerTestPageWithoutController::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -148,7 +148,7 @@ class ContentControllerTest extends FunctionalTest
|
||||
|
||||
$link = $page->RelativeLink();
|
||||
$response = $this->get($link);
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
sprintf('<a href="%s">Testlink</a>', $linkedPage->Link()),
|
||||
$response->getBody(),
|
||||
'"sitetree_link" shortcodes get parsed properly'
|
||||
|
@ -17,12 +17,12 @@ class LeftAndMainPageIconsExtensionTest extends SapphireTest
|
||||
{
|
||||
$extension = new LeftAndMainPageIconsExtension();
|
||||
$css = $extension->generatePageIconsCss();
|
||||
$this->assertNotContains('some invalid string', $css);
|
||||
$this->assertContains(
|
||||
$this->assertStringNotContainsString('some invalid string', $css);
|
||||
$this->assertStringContainsString(
|
||||
'tests/php/Controllers/LeftAndMainPageIconsExtensionTest/icon_b.jpg?m=',
|
||||
$css
|
||||
);
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
'tests/php/Controllers/LeftAndMainPageIconsExtensionTest/icon_c.jpg?m=',
|
||||
$css
|
||||
);
|
||||
|
@ -25,7 +25,7 @@ class ModelAsControllerTest extends FunctionalTest
|
||||
* This setup will enable nested-urls for this test and resets the state
|
||||
* after the tests have been performed.
|
||||
*/
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||
|
@ -13,7 +13,7 @@ use SilverStripe\GraphQL\Schema\SchemaConfig;
|
||||
|
||||
class LinkablePluginTest extends SapphireTest
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -14,7 +14,7 @@ class RedirectorPageTest extends FunctionalTest
|
||||
|
||||
protected $autoFollowRedirection = false;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Director::config()->update('alternate_base_url', 'http://www.mysite.com/');
|
||||
@ -42,13 +42,13 @@ class RedirectorPageTest extends FunctionalTest
|
||||
|
||||
/* An error message will be shown if you visit it */
|
||||
$content = $this->get(Director::makeRelative($page1->Link()))->getBody();
|
||||
$this->assertContains('message-setupWithoutRedirect', $content);
|
||||
$this->assertStringContainsString('message-setupWithoutRedirect', $content);
|
||||
|
||||
/* This also applies for internal links */
|
||||
$page2 = $this->objFromFixture(RedirectorPage::class, 'badinternal');
|
||||
$this->assertEquals('/bad-internal/', $page2->Link());
|
||||
$content = $this->get(Director::makeRelative($page2->Link()))->getBody();
|
||||
$this->assertContains('message-setupWithoutRedirect', $content);
|
||||
$this->assertStringContainsString('message-setupWithoutRedirect', $content);
|
||||
}
|
||||
|
||||
public function testReflexiveAndTransitiveInternalRedirectors()
|
||||
@ -57,7 +57,7 @@ class RedirectorPageTest extends FunctionalTest
|
||||
$page = $this->objFromFixture(RedirectorPage::class, 'reflexive');
|
||||
$this->assertEquals('/reflexive/', $page->Link());
|
||||
$content = $this->get(Director::makeRelative($page->Link()))->getBody();
|
||||
$this->assertContains('message-setupWithoutRedirect', $content);
|
||||
$this->assertStringContainsString('message-setupWithoutRedirect', $content);
|
||||
|
||||
/* Transitive redirectors are those that point to another redirector page. They should send people to the URLSegment
|
||||
* of the destination page - the middle-stop, so to speak. That should redirect to the final destination */
|
||||
|
@ -26,7 +26,7 @@ class SiteTreeBacklinksTest extends SapphireTest
|
||||
SiteTreeBacklinksTestContentObject::class,
|
||||
];
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -286,6 +286,6 @@ class SiteTreeBacklinksTest extends SapphireTest
|
||||
|
||||
$content = $gridField->getColumnContent($list->first(), 'Title');
|
||||
|
||||
$this->assertContains('Untitled Backlink test content object', $content);
|
||||
$this->assertStringContainsString('Untitled Backlink test content object', $content);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest
|
||||
NotPageObject::class,
|
||||
];
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -34,7 +34,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest
|
||||
$this->logInWithPermission('ADMIN');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown();
|
||||
|
@ -16,7 +16,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
|
||||
{
|
||||
protected static $fixture_file = 'SiteTreeHTMLEditorFieldTest.yml';
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
TestAssetStore::activate('SiteTreeHTMLEditorFieldTest');
|
||||
@ -37,7 +37,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
|
||||
}
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
TestAssetStore::reset();
|
||||
parent::tearDown();
|
||||
|
@ -11,7 +11,7 @@ use SilverStripe\View\Parsers\HTMLValue;
|
||||
class SiteTreeLinkTrackingTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
Director::config()->set('alternate_base_url', 'http://www.mysite.com/');
|
||||
|
@ -25,7 +25,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
||||
SiteTree::class => [SiteTreeSubsites::class],
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -63,7 +63,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
||||
$response = $responseException->getResponse();
|
||||
}
|
||||
$this->assertEquals($response->getStatusCode(), '302');
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
Security::config()->get('login_url'),
|
||||
$response->getHeader('Location')
|
||||
);
|
||||
|
@ -1289,7 +1289,7 @@ class SiteTreeTest extends SapphireTest
|
||||
try {
|
||||
$notRootPage->write();
|
||||
} catch (ValidationException $e) {
|
||||
$this->assertContains('is not allowed on the root level', $e->getMessage());
|
||||
$this->assertStringContainsString('is not allowed on the root level', $e->getMessage());
|
||||
$isDetected = true;
|
||||
}
|
||||
|
||||
@ -1302,8 +1302,8 @@ class SiteTreeTest extends SapphireTest
|
||||
{
|
||||
$node = new SiteTreeTest_StageStatusInherit();
|
||||
$treeTitle = $node->getTreeTitle();
|
||||
$this->assertContains('InheritedTitle', $treeTitle);
|
||||
$this->assertContains('inherited-class', $treeTitle);
|
||||
$this->assertStringContainsString('InheritedTitle', $treeTitle);
|
||||
$this->assertStringContainsString('inherited-class', $treeTitle);
|
||||
}
|
||||
|
||||
public function testMenuTitleIsUnsetWhenEqualsTitle()
|
||||
@ -1336,8 +1336,8 @@ class SiteTreeTest extends SapphireTest
|
||||
$page = new SiteTreeTest_PageNode();
|
||||
|
||||
$meta = $page->MetaTags();
|
||||
$this->assertContains('meta name="generator"', $meta, 'Should include generator tag');
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString('meta name="generator"', $meta, 'Should include generator tag');
|
||||
$this->assertStringContainsString(
|
||||
'content="SilverStripe - https://www.silverstripe.org',
|
||||
$meta,
|
||||
'Should contain default meta generator info'
|
||||
@ -1346,7 +1346,7 @@ class SiteTreeTest extends SapphireTest
|
||||
// test proper escaping of quotes in attribute value
|
||||
Config::modify()->set(SiteTree::class, 'meta_generator', 'Generator with "quotes" in it');
|
||||
$meta = $page->MetaTags();
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
'content="Generator with "quotes" in it',
|
||||
$meta,
|
||||
'test proper escaping of values from Config'
|
||||
@ -1355,7 +1355,7 @@ class SiteTreeTest extends SapphireTest
|
||||
// test empty generator - no tag should appear at all
|
||||
Config::modify()->set(SiteTree::class, 'meta_generator', '');
|
||||
$meta = $page->MetaTags();
|
||||
$this->assertNotContains(
|
||||
$this->assertStringNotContainsString(
|
||||
'meta name="generator"',
|
||||
$meta,
|
||||
'test blank value means no tag generated'
|
||||
@ -1394,19 +1394,19 @@ class SiteTreeTest extends SapphireTest
|
||||
// Test with title
|
||||
$meta = $page->MetaTags();
|
||||
$charset = Config::inst()->get(ContentNegotiator::class, 'encoding');
|
||||
$this->assertContains('<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'"', $meta);
|
||||
$this->assertContains('<meta name="description" content="The <br /> and <br> tags"', $meta);
|
||||
$this->assertContains('<link rel="canonical" href="http://www.mysite.com/html-and-xml"', $meta);
|
||||
$this->assertContains('<meta name="x-page-id" content="'.$page->ID.'"', $meta);
|
||||
$this->assertContains('<meta name="x-cms-edit-link" content="'.$page->CMSEditLink().'"', $meta);
|
||||
$this->assertContains('<title>HTML & XML</title>', $meta);
|
||||
$this->assertStringContainsString('<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'"', $meta);
|
||||
$this->assertStringContainsString('<meta name="description" content="The <br /> and <br> tags"', $meta);
|
||||
$this->assertStringContainsString('<link rel="canonical" href="http://www.mysite.com/html-and-xml"', $meta);
|
||||
$this->assertStringContainsString('<meta name="x-page-id" content="'.$page->ID.'"', $meta);
|
||||
$this->assertStringContainsString('<meta name="x-cms-edit-link" content="'.$page->CMSEditLink().'"', $meta);
|
||||
$this->assertStringContainsString('<title>HTML & XML</title>', $meta);
|
||||
|
||||
// Test without title
|
||||
$meta = $page->MetaTags(false);
|
||||
$this->assertNotContains('<title>', $meta);
|
||||
$this->assertStringNotContainsString('<title>', $meta);
|
||||
|
||||
$meta = $page->MetaTags('false');
|
||||
$this->assertNotContains('<title>', $meta);
|
||||
$this->assertStringNotContainsString('<title>', $meta);
|
||||
}
|
||||
|
||||
public function testMetaComponents()
|
||||
|
@ -46,7 +46,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
]
|
||||
];
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -477,7 +477,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
try {
|
||||
$virtual->write();
|
||||
} catch (ValidationException $e) {
|
||||
$this->assertContains('is not allowed on the root level', $e->getMessage());
|
||||
$this->assertStringContainsString('is not allowed on the root level', $e->getMessage());
|
||||
$isDetected = true;
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
try {
|
||||
$childVirtualPage->write();
|
||||
} catch (ValidationException $e) {
|
||||
$this->assertContains('not allowed as child of this parent page', $e->getMessage());
|
||||
$this->assertStringContainsString('not allowed as child of this parent page', $e->getMessage());
|
||||
$isDetected = true;
|
||||
}
|
||||
|
||||
@ -644,8 +644,8 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
$response = $this->get($vp->Link());
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertContains('TestContent', $response->getBody());
|
||||
$this->assertNotContains('NotThisContent', $response->getBody());
|
||||
$this->assertStringContainsString('TestContent', $response->getBody());
|
||||
$this->assertStringNotContainsString('NotThisContent', $response->getBody());
|
||||
|
||||
// VirtualPageTest_ClassB doesn't have an associated controller for
|
||||
// ModelAsController::controller_for() to find
|
||||
@ -661,7 +661,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
$response = $this->get($vp->Link());
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertContains('Test Page B', $response->getBody());
|
||||
$this->assertStringContainsString('Test Page B', $response->getBody());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ class CmsReportsTest extends SapphireTest
|
||||
|
||||
private static $daysAgo = 14;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -28,7 +28,7 @@ class CMSMainSearchFormTest extends FunctionalTest
|
||||
$this->assertEquals(count($titles), 1);
|
||||
// For some reason the title gets split into two lines
|
||||
|
||||
$this->assertContains('Page 1', $titles[0]);
|
||||
$this->assertStringContainsString('Page 1', $titles[0]);
|
||||
}
|
||||
|
||||
protected function getPageTitles()
|
||||
|
@ -18,7 +18,7 @@ class DatabaseSearchEngineTest extends SapphireTest
|
||||
*/
|
||||
protected $usesTransactions = false;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
|
@ -57,7 +57,7 @@ class ZZZSearchFormTest extends FunctionalTest
|
||||
}
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
// HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE
|
||||
// MySQL will need a different table type
|
||||
@ -69,7 +69,7 @@ class ZZZSearchFormTest extends FunctionalTest
|
||||
parent::setUpBeforeClass();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -110,7 +110,7 @@ class ZZZSearchFormTest extends FunctionalTest
|
||||
|
||||
$sf->setTemplate('BlankPage');
|
||||
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
'<body class="SearchForm Form BlankPage">',
|
||||
$sf->forTemplate()
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
|
||||
|
||||
protected static $use_draft_site = true;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
@ -34,7 +34,7 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
|
||||
});
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -59,7 +59,7 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
|
||||
DB::quiet(false);
|
||||
$task = new MigrateSiteTreeLinkingTask();
|
||||
$task->run(null);
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
"Migrated page links on 5 Pages",
|
||||
ob_get_contents(),
|
||||
'Rewritten links are correctly reported'
|
||||
|
@ -38,7 +38,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest
|
||||
{
|
||||
protected static $fixture_file = 'RemoveOrphanedPagesTaskTest.yml';
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user