Skip to content

Commit

Permalink
API phpunit 9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 19, 2021
1 parent 3f8b3d1 commit 59aa9c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"silverstripe/cms": "^4.0"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<testsuites>
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
Expand Down
14 changes: 7 additions & 7 deletions tests/IFramePageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public function testGetClass()
$iframe->AutoHeight = 1;
$iframe->getClass();

$this->assertContains('iframepage-height-auto', $iframe->getClass());
$this->assertStringContainsString('iframepage-height-auto', $iframe->getClass());

$iframe->AutoHeight = 0;
$iframe->getClass();

$this->assertNotContains('iframepage-height-auto', $iframe->getClass());
$this->assertStringNotContainsString('iframepage-height-auto', $iframe->getClass());
}

public function testGetStyle()
Expand All @@ -33,19 +33,19 @@ public function testGetStyle()

$iframe->FixedHeight = 0;
$iframe->getStyle();
$this->assertContains('height: 800px', $iframe->getStyle(), 'Height defaults to 800 if not set.');
$this->assertStringContainsString('height: 800px', $iframe->getStyle(), 'Height defaults to 800 if not set.');

$iframe->FixedHeight = 100;
$iframe->getStyle();
$this->assertContains('height: 100px', $iframe->getStyle(), 'Fixed height is settable');
$this->assertStringContainsString('height: 100px', $iframe->getStyle(), 'Fixed height is settable');

$iframe->AutoWidth = 1;
$iframe->FixedWidth = '200';
$this->assertContains('width: 100%', $iframe->getStyle(), 'Auto width overrides fixed width');
$this->assertStringContainsString('width: 100%', $iframe->getStyle(), 'Auto width overrides fixed width');

$iframe->AutoWidth = 0;
$iframe->FixedWidth = '200';
$this->assertContains('width: 200px', $iframe->getStyle(), 'Fixed width is settable');
$this->assertStringContainsString('width: 200px', $iframe->getStyle(), 'Fixed width is settable');
}

public function testAllowedUrls()
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testAllowedUrls()

foreach ($tests['banned'] as $url) {
$iframe->IFrameURL = $url;
$this->setExpectedException(ValidationException::class);
$this->expectException(ValidationException::class);
$iframe->write();
}
}
Expand Down

0 comments on commit 59aa9c0

Please sign in to comment.