Killing a few "mutants"
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
2023-11-03 12:02:44 +00:00
parent 61001edaa0
commit 66ccb3d8d6
5 changed files with 37 additions and 12 deletions

View File

@ -30,12 +30,19 @@ final class NtfyTest extends TestCase
$config = ['domain' => 'https://test.com', 'topic' => 'something'];
$instance = Ntfy::factory($config);
$this->assertInstanceOf(Ntfy::class, $instance);
$this->assertEquals($instance->getTopic(), "something");
}
public function testSend(): void
public function testSendShort(): void
{
$this->client->expects($this->once())->method('send')->with($this->isInstanceOf(Message::class));
$this->instance->send('title', 'text');
$this->instance->send('t', 's');
}
public function testSendLong(): void
{
$this->client->expects($this->once())->method('send')->with($this->isInstanceOf(Message::class));
$this->instance->send(str_repeat("t", Ntfy::TOPIC_MAX_LENGTH), str_repeat("t", Ntfy::MESSAGE_MAX_LENGTH));
}
/** @return array<int, array<int, string>> */
@ -45,8 +52,8 @@ final class NtfyTest extends TestCase
['', ''],
['', 'text'],
['title', ''],
[str_repeat("t", 256),'text'],
['title',str_repeat("t", 4096)],
[str_repeat("t", Ntfy::TOPIC_MAX_LENGTH+1),'text'],
['title',str_repeat("t", Ntfy::MESSAGE_MAX_LENGTH+1)],
];
}
@ -59,7 +66,11 @@ final class NtfyTest extends TestCase
public function testSetTopic(): void
{
$topic = "abcdefg";
$topic = "a";
$this->instance->setTopic($topic);
$this->assertEquals($topic, $this->instance->getTopic());
$topic = str_repeat("a", Ntfy::TOPIC_MAX_LENGTH);
$this->instance->setTopic($topic);
$this->assertEquals($topic, $this->instance->getTopic());
}
@ -69,8 +80,8 @@ final class NtfyTest extends TestCase
{
return [
[''],
[str_repeat("t", 256)],
[str_repeat("t", 4096)],
[str_repeat("t", Ntfy::TOPIC_MAX_LENGTH+1)],
[str_repeat("t", Ntfy::MESSAGE_MAX_LENGTH+1)],
];
}