change tests for phpunit 9 support, breaking support with phpunit 5.6

This commit is contained in:
El RIDO
2020-10-11 10:31:24 +02:00
parent 37a620df95
commit 17c3cb35c0
13 changed files with 128 additions and 186 deletions

View File

@@ -95,28 +95,28 @@ class ViewTest extends TestCase
public function testTemplateRendersCorrectly()
{
foreach ($this->_content as $template => $content) {
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]+id="errormessage"[^>]*>.*' . self::$error . '#s',
$content,
$template . ': outputs error correctly'
);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<[^>]+id="password"[^>]*>#',
$content,
$template . ': password available if configured'
);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
$content,
$template . ': checked discussion if configured'
);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<[^>]+id="opendiscussionoption"[^>]*>#',
$content,
$template . ': discussions available if configured'
);
// testing version number in JS address, since other instances may not be present in different templates
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<script[^>]+src="js/privatebin.js\\?' . rawurlencode(self::$version) . '"[^>]*>#',
$content,
$template . ': outputs version correctly'
@@ -124,13 +124,11 @@ class ViewTest extends TestCase
}
}
/**
* @expectedException Exception
* @expectedExceptionCode 80
*/
public function testMissingTemplate()
{
$test = new View;
$this->expectException(Exception::class);
$this->expectExceptionCode(80);
$test->draw('123456789 does not exist!');
}
}