Merge pull request #10307 from nupplaphil/bug/some_phpunit_warnings
Fix PHPUnit 8 warnings
This commit is contained in:
commit
1e00bf430e
|
@ -189,7 +189,7 @@ class ApiTest extends FixtureTest
|
||||||
private function assertXml($result = '', $root_element = '')
|
private function assertXml($result = '', $root_element = '')
|
||||||
{
|
{
|
||||||
self::assertStringStartsWith('<?xml version="1.0"?>', $result);
|
self::assertStringStartsWith('<?xml version="1.0"?>', $result);
|
||||||
self::assertContains('<' . $root_element, $result);
|
self::assertStringContainsString('<' . $root_element, $result);
|
||||||
// We could probably do more checks here.
|
// We could probably do more checks here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,7 +1505,7 @@ class ApiTest extends FixtureTest
|
||||||
$result = api_search('json');
|
$result = api_search('json');
|
||||||
foreach ($result['status'] as $status) {
|
foreach ($result['status'] as $status) {
|
||||||
self::assertStatus($status);
|
self::assertStatus($status);
|
||||||
self::assertContains('reply', $status['text'], '', true);
|
self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1521,7 +1521,7 @@ class ApiTest extends FixtureTest
|
||||||
$result = api_search('json');
|
$result = api_search('json');
|
||||||
foreach ($result['status'] as $status) {
|
foreach ($result['status'] as $status) {
|
||||||
self::assertStatus($status);
|
self::assertStatus($status);
|
||||||
self::assertContains('reply', $status['text'], '', true);
|
self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1537,7 +1537,7 @@ class ApiTest extends FixtureTest
|
||||||
$result = api_search('json');
|
$result = api_search('json');
|
||||||
foreach ($result['status'] as $status) {
|
foreach ($result['status'] as $status) {
|
||||||
self::assertStatus($status);
|
self::assertStatus($status);
|
||||||
self::assertContains('reply', $status['text'], '', true);
|
self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1551,7 +1551,7 @@ class ApiTest extends FixtureTest
|
||||||
$result = api_search('json');
|
$result = api_search('json');
|
||||||
foreach ($result['status'] as $status) {
|
foreach ($result['status'] as $status) {
|
||||||
self::assertStatus($status);
|
self::assertStatus($status);
|
||||||
self::assertContains('#friendica', $status['text'], '', true);
|
self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2874,7 +2874,7 @@ class ApiTest extends FixtureTest
|
||||||
$_POST['text'] = 'message_text';
|
$_POST['text'] = 'message_text';
|
||||||
$_POST['screen_name'] = $this->friendUser['nick'];
|
$_POST['screen_name'] = $this->friendUser['nick'];
|
||||||
$result = api_direct_messages_new('json');
|
$result = api_direct_messages_new('json');
|
||||||
self::assertContains('message_text', $result['direct_message']['text']);
|
self::assertStringContainsString('message_text', $result['direct_message']['text']);
|
||||||
self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
|
self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
|
||||||
self::assertEquals(1, $result['direct_message']['friendica_seen']);
|
self::assertEquals(1, $result['direct_message']['friendica_seen']);
|
||||||
}
|
}
|
||||||
|
@ -2891,8 +2891,8 @@ class ApiTest extends FixtureTest
|
||||||
$_POST['screen_name'] = $this->friendUser['nick'];
|
$_POST['screen_name'] = $this->friendUser['nick'];
|
||||||
$_REQUEST['title'] = 'message_title';
|
$_REQUEST['title'] = 'message_title';
|
||||||
$result = api_direct_messages_new('json');
|
$result = api_direct_messages_new('json');
|
||||||
self::assertContains('message_text', $result['direct_message']['text']);
|
self::assertStringContainsString('message_text', $result['direct_message']['text']);
|
||||||
self::assertContains('message_title', $result['direct_message']['text']);
|
self::assertStringContainsString('message_title', $result['direct_message']['text']);
|
||||||
self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
|
self::assertEquals('selfcontact', $result['direct_message']['sender_screen_name']);
|
||||||
self::assertEquals(1, $result['direct_message']['friendica_seen']);
|
self::assertEquals(1, $result['direct_message']['friendica_seen']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class FilesystemStorageTest extends StorageTest
|
||||||
public function testMissingDirPermissions()
|
public function testMissingDirPermissions()
|
||||||
{
|
{
|
||||||
$this->expectException(StorageException::class);
|
$this->expectException(StorageException::class);
|
||||||
$this->expectExceptionMessageRegExp("/Filesystem storage failed to create \".*\". Check you write permissions./");
|
$this->expectExceptionMessageMatches("/Filesystem storage failed to create \".*\". Check you write permissions./");
|
||||||
$this->root->getChild('storage')->chmod(000);
|
$this->root->getChild('storage')->chmod(000);
|
||||||
|
|
||||||
$instance = $this->getInstance();
|
$instance = $this->getInstance();
|
||||||
|
@ -97,7 +97,7 @@ class FilesystemStorageTest extends StorageTest
|
||||||
static::markTestIncomplete("Cannot catch file_put_content() error due vfsStream failure");
|
static::markTestIncomplete("Cannot catch file_put_content() error due vfsStream failure");
|
||||||
|
|
||||||
$this->expectException(StorageException::class);
|
$this->expectException(StorageException::class);
|
||||||
$this->expectExceptionMessageRegExp("/Filesystem storage failed to save data to \".*\". Check your write permissions/");
|
$this->expectExceptionMessageMatches("/Filesystem storage failed to save data to \".*\". Check your write permissions/");
|
||||||
|
|
||||||
vfsStream::create(['storage' => ['f0' => ['c0' => ['k0i0' => '']]]], $this->root);
|
vfsStream::create(['storage' => ['f0' => ['c0' => ['k0i0' => '']]]], $this->root);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class BasePathTest extends MockedTest
|
||||||
public function testFailedBasePath()
|
public function testFailedBasePath()
|
||||||
{
|
{
|
||||||
$this->expectException(\Exception::class);
|
$this->expectException(\Exception::class);
|
||||||
$this->expectExceptionMessageRegExp("/(.*) is not a valid basepath/");
|
$this->expectExceptionMessageMatches("/(.*) is not a valid basepath/");
|
||||||
|
|
||||||
$basepath = new BasePath('/now23452sgfgas', []);
|
$basepath = new BasePath('/now23452sgfgas', []);
|
||||||
$basepath->getPath();
|
$basepath->getPath();
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfigFileLoaderTest extends MockedTest
|
||||||
*/
|
*/
|
||||||
public function testLoadConfigWrong()
|
public function testLoadConfigWrong()
|
||||||
{
|
{
|
||||||
$this->expectExceptionMessageRegExp("/Error loading config file \w+/");
|
$this->expectExceptionMessageMatches("/Error loading config file \w+/");
|
||||||
$this->expectException(\Exception::class);
|
$this->expectException(\Exception::class);
|
||||||
$this->delConfigFile('local.config.php');
|
$this->delConfigFile('local.config.php');
|
||||||
|
|
||||||
|
|
|
@ -78,16 +78,16 @@ class EMailerTest extends MockedTest
|
||||||
|
|
||||||
self::assertTrue($emailer->send($testEmail));
|
self::assertTrue($emailer->send($testEmail));
|
||||||
|
|
||||||
self::assertContains("X-Friendica-Host: friendica.local", EmailerSpy::$MAIL_DATA['headers']);
|
self::assertStringContainsString("X-Friendica-Host: friendica.local", EmailerSpy::$MAIL_DATA['headers']);
|
||||||
self::assertContains("X-Friendica-Platform: Friendica", EmailerSpy::$MAIL_DATA['headers']);
|
self::assertStringContainsString("X-Friendica-Platform: Friendica", EmailerSpy::$MAIL_DATA['headers']);
|
||||||
self::assertContains("List-ID: <notification.friendica.local>", EmailerSpy::$MAIL_DATA['headers']);
|
self::assertStringContainsString("List-ID: <notification.friendica.local>", EmailerSpy::$MAIL_DATA['headers']);
|
||||||
self::assertContains("List-Archive: <http://friendica.local/notifications/system>", EmailerSpy::$MAIL_DATA['headers']);
|
self::assertStringContainsString("List-Archive: <http://friendica.local/notifications/system>", EmailerSpy::$MAIL_DATA['headers']);
|
||||||
self::assertContains("Reply-To: Sender <sender@friendica.local>", EmailerSpy::$MAIL_DATA['headers']);
|
self::assertStringContainsString("Reply-To: Sender <sender@friendica.local>", EmailerSpy::$MAIL_DATA['headers']);
|
||||||
self::assertContains("MIME-Version: 1.0", EmailerSpy::$MAIL_DATA['headers']);
|
self::assertStringContainsString("MIME-Version: 1.0", EmailerSpy::$MAIL_DATA['headers']);
|
||||||
// Base64 "Test Text"
|
// Base64 "Test Text"
|
||||||
self::assertContains(chunk_split(base64_encode('Test Text')), EmailerSpy::$MAIL_DATA['body']);
|
self::assertStringContainsString(chunk_split(base64_encode('Test Text')), EmailerSpy::$MAIL_DATA['body']);
|
||||||
// Base64 "Test Message<b>Bold</b>"
|
// Base64 "Test Message<b>Bold</b>"
|
||||||
self::assertContains(chunk_split(base64_encode("Test Message<b>Bold</b>")), EmailerSpy::$MAIL_DATA['body']);
|
self::assertStringContainsString(chunk_split(base64_encode("Test Message<b>Bold</b>")), EmailerSpy::$MAIL_DATA['body']);
|
||||||
self::assertEquals("Test Subject", EmailerSpy::$MAIL_DATA['subject']);
|
self::assertEquals("Test Subject", EmailerSpy::$MAIL_DATA['subject']);
|
||||||
self::assertEquals("recipient@friendica.local", EmailerSpy::$MAIL_DATA['to']);
|
self::assertEquals("recipient@friendica.local", EmailerSpy::$MAIL_DATA['to']);
|
||||||
self::assertEquals("-f sender@friendica.local", EmailerSpy::$MAIL_DATA['parameters']);
|
self::assertEquals("-f sender@friendica.local", EmailerSpy::$MAIL_DATA['parameters']);
|
||||||
|
|
|
@ -106,8 +106,8 @@ abstract class AbstractLoggerTest extends MockedTest
|
||||||
$logger->emergency('A {psr} test', ['psr' => 'working']);
|
$logger->emergency('A {psr} test', ['psr' => 'working']);
|
||||||
$logger->alert('An {array} test', ['array' => ['it', 'is', 'working']]);
|
$logger->alert('An {array} test', ['array' => ['it', 'is', 'working']]);
|
||||||
$text = $this->getContent();
|
$text = $this->getContent();
|
||||||
self::assertContains('A working test', $text);
|
self::assertStringContainsString('A working test', $text);
|
||||||
self::assertContains('An ["it","is","working"] test', $text);
|
self::assertStringContainsString('An ["it","is","working"] test', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,9 +119,9 @@ abstract class AbstractLoggerTest extends MockedTest
|
||||||
$logger->emergency('A test');
|
$logger->emergency('A test');
|
||||||
|
|
||||||
$text = $this->getContent();
|
$text = $this->getContent();
|
||||||
self::assertContains('"file":"' . self::FILE . '"', $text);
|
self::assertStringContainsString('"file":"' . self::FILE . '"', $text);
|
||||||
self::assertContains('"line":' . self::LINE, $text);
|
self::assertStringContainsString('"line":' . self::LINE, $text);
|
||||||
self::assertContains('"function":"' . self::FUNC . '"', $text);
|
self::assertStringContainsString('"function":"' . self::FUNC . '"', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +157,7 @@ abstract class AbstractLoggerTest extends MockedTest
|
||||||
|
|
||||||
self::assertLogline($text);
|
self::assertLogline($text);
|
||||||
|
|
||||||
self::assertContains(@json_encode($context), $text);
|
self::assertStringContainsString(@json_encode($context), $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +176,7 @@ abstract class AbstractLoggerTest extends MockedTest
|
||||||
|
|
||||||
self::assertLogline($text);
|
self::assertLogline($text);
|
||||||
|
|
||||||
self::assertContains(@json_encode($assertion), $this->getContent());
|
self::assertStringContainsString(@json_encode($assertion), $this->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNoObjectHandling()
|
public function testNoObjectHandling()
|
||||||
|
@ -187,6 +187,6 @@ abstract class AbstractLoggerTest extends MockedTest
|
||||||
|
|
||||||
self::assertLogline($text);
|
self::assertLogline($text);
|
||||||
|
|
||||||
self::assertContains('test', $this->getContent());
|
self::assertStringContainsString('test', $this->getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class StreamLoggerTest extends AbstractLoggerTest
|
||||||
public function testWrongUrl()
|
public function testWrongUrl()
|
||||||
{
|
{
|
||||||
$this->expectException(\UnexpectedValueException::class);
|
$this->expectException(\UnexpectedValueException::class);
|
||||||
$this->expectExceptionMessageRegExp("/The stream or file .* could not be opened: .* /");
|
$this->expectExceptionMessageMatches("/The stream or file .* could not be opened: .* /");
|
||||||
|
|
||||||
$logfile = vfsStream::newFile('friendica.log')
|
$logfile = vfsStream::newFile('friendica.log')
|
||||||
->at($this->root)->chmod(0);
|
->at($this->root)->chmod(0);
|
||||||
|
@ -144,7 +144,7 @@ class StreamLoggerTest extends AbstractLoggerTest
|
||||||
public function testWrongDir()
|
public function testWrongDir()
|
||||||
{
|
{
|
||||||
$this->expectException(\UnexpectedValueException::class);
|
$this->expectException(\UnexpectedValueException::class);
|
||||||
$this->expectExceptionMessageRegExp("/Directory .* cannot get created: .* /");
|
$this->expectExceptionMessageMatches("/Directory .* cannot get created: .* /");
|
||||||
|
|
||||||
static::markTestIncomplete('We need a platform independent way to set directory to readonly');
|
static::markTestIncomplete('We need a platform independent way to set directory to readonly');
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class StreamLoggerTest extends AbstractLoggerTest
|
||||||
public function testWrongMinimumLevel()
|
public function testWrongMinimumLevel()
|
||||||
{
|
{
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessageRegExp("/The level \".*\" is not valid./");
|
$this->expectExceptionMessageMatches("/The level \".*\" is not valid./");
|
||||||
|
|
||||||
$logger = new StreamLogger('test', 'file.text', $this->introspection, $this->fileSystem, 'NOPE');
|
$logger = new StreamLogger('test', 'file.text', $this->introspection, $this->fileSystem, 'NOPE');
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ class StreamLoggerTest extends AbstractLoggerTest
|
||||||
public function testWrongLogLevel()
|
public function testWrongLogLevel()
|
||||||
{
|
{
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessageRegExp("/The level \".*\" is not valid./");
|
$this->expectExceptionMessageMatches("/The level \".*\" is not valid./");
|
||||||
|
|
||||||
$logfile = vfsStream::newFile('friendica.log')
|
$logfile = vfsStream::newFile('friendica.log')
|
||||||
->at($this->root);
|
->at($this->root);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class SyslogLoggerTest extends AbstractLoggerTest
|
||||||
public function testWrongMinimumLevel()
|
public function testWrongMinimumLevel()
|
||||||
{
|
{
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessageRegExp("/The level \".*\" is not valid./");
|
$this->expectExceptionMessageMatches("/The level \".*\" is not valid./");
|
||||||
|
|
||||||
$logger = new SyslogLoggerWrapper('test', $this->introspection, 'NOPE');
|
$logger = new SyslogLoggerWrapper('test', $this->introspection, 'NOPE');
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class SyslogLoggerTest extends AbstractLoggerTest
|
||||||
public function testWrongLogLevel()
|
public function testWrongLogLevel()
|
||||||
{
|
{
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->expectExceptionMessageRegExp("/The level \".*\" is not valid./");
|
$this->expectExceptionMessageMatches("/The level \".*\" is not valid./");
|
||||||
|
|
||||||
$logger = new SyslogLoggerWrapper('test', $this->introspection);
|
$logger = new SyslogLoggerWrapper('test', $this->introspection);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class SyslogLoggerTest extends AbstractLoggerTest
|
||||||
{
|
{
|
||||||
if (PHP_MAJOR_VERSION < 8) {
|
if (PHP_MAJOR_VERSION < 8) {
|
||||||
$this->expectException(\UnexpectedValueException::class);
|
$this->expectException(\UnexpectedValueException::class);
|
||||||
$this->expectExceptionMessageRegExp("/Can\'t open syslog for ident \".*\" and facility \".*\": .* /");
|
$this->expectExceptionMessageMatches("/Can\'t open syslog for ident \".*\" and facility \".*\": .* /");
|
||||||
} else {
|
} else {
|
||||||
$this->expectException(\TypeError::class);
|
$this->expectException(\TypeError::class);
|
||||||
$this->expectExceptionMessage("openlog(): Argument #3 (\$facility) must be of type int, string given");
|
$this->expectExceptionMessage("openlog(): Argument #3 (\$facility) must be of type int, string given");
|
||||||
|
|
Loading…
Reference in a new issue