This commit is contained in:
@ -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)],
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user