FIX Replace static assertions with instance calls

This commit is contained in:
Robbie Averill 2017-08-29 17:30:22 +12:00
parent 7ffaf61aeb
commit c081de1202
4 changed files with 13 additions and 13 deletions

View File

@ -40,6 +40,6 @@ class SiteConfigSubsitesTest extends BaseSubsiteTest
$this->assertEquals('Subsite2', SiteConfig::current_site_config()->Title); $this->assertEquals('Subsite2', SiteConfig::current_site_config()->Title);
$keys = SiteConfig::current_site_config()->extend('cacheKeyComponent'); $keys = SiteConfig::current_site_config()->extend('cacheKeyComponent');
static::assertContains('subsite-' . $subsite2->ID, $keys); $this->assertContains('subsite-' . $subsite2->ID, $keys);
} }
} }

View File

@ -255,16 +255,16 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest
Subsite::changeSubsite($s1); Subsite::changeSubsite($s1);
$hints = Convert::json2array($cmsmain->SiteTreeHints()); $hints = Convert::json2array($cmsmain->SiteTreeHints());
$classes = $hints['Root']['disallowedChildren']; $classes = $hints['Root']['disallowedChildren'];
static::assertContains(ErrorPage::class, $classes); $this->assertContains(ErrorPage::class, $classes);
static::assertContains(TestClassA::class, $classes); $this->assertContains(TestClassA::class, $classes);
static::assertNotContains(TestClassB::class, $classes); $this->assertNotContains(TestClassB::class, $classes);
Subsite::changeSubsite($s2); Subsite::changeSubsite($s2);
$hints = Convert::json2array($cmsmain->SiteTreeHints()); $hints = Convert::json2array($cmsmain->SiteTreeHints());
$classes = $hints['Root']['disallowedChildren']; $classes = $hints['Root']['disallowedChildren'];
static::assertNotContains(ErrorPage::class, $classes); $this->assertNotContains(ErrorPage::class, $classes);
static::assertNotContains(TestClassA::class, $classes); $this->assertNotContains(TestClassA::class, $classes);
static::assertNotContains(TestClassB::class, $classes); $this->assertNotContains(TestClassB::class, $classes);
} }
/** /**

View File

@ -37,9 +37,9 @@ class SubsiteXHRControllerTest extends FunctionalTest
$this->assertEquals(200, $result->getStatusCode()); $this->assertEquals(200, $result->getStatusCode());
$this->assertEquals('text/json', $result->getHeader('Content-Type')); $this->assertEquals('text/json', $result->getHeader('Content-Type'));
$body = $result->getBody(); $body = $result->getBody();
static::assertContains('Main site', $body); $this->assertContains('Main site', $body);
static::assertContains('Test 1', $body); $this->assertContains('Test 1', $body);
static::assertContains('Test 2', $body); $this->assertContains('Test 2', $body);
static::assertContains('Test 3', $body); $this->assertContains('Test 3', $body);
} }
} }

View File

@ -97,11 +97,11 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest
$file->write(); $file->write();
// Verify that the draft and publish virtual pages both have the corrected link // Verify that the draft and publish virtual pages both have the corrected link
static::assertContains( $this->assertContains(
'<img src="/assets/SubsitesVirtualPageTest/464dedb70a/renamed-test-file.pdf"', '<img src="/assets/SubsitesVirtualPageTest/464dedb70a/renamed-test-file.pdf"',
DB::query("SELECT \"Content\" FROM \"SiteTree\" WHERE \"ID\" = $svp->ID")->value() DB::query("SELECT \"Content\" FROM \"SiteTree\" WHERE \"ID\" = $svp->ID")->value()
); );
static::assertContains( $this->assertContains(
'<img src="/assets/SubsitesVirtualPageTest/464dedb70a/renamed-test-file.pdf"', '<img src="/assets/SubsitesVirtualPageTest/464dedb70a/renamed-test-file.pdf"',
DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $svp->ID")->value() DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $svp->ID")->value()
); );