Skip to content

Commit bcded22

Browse files
authored
Merge pull request repejota#69 from repejota/big_subjects
Test for big subjects message publication
2 parents dcefa3d + 34b6eec commit bcded22

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ cs: lint
99
./bin/phpcs --standard=PSR2 --warning-severity=0 src tests examples
1010
./bin/phpcs --standard=Squiz --sniffs=Squiz.Commenting.FunctionComment,Squiz.Commenting.FunctionCommentThrowTag,Squiz.Commenting.ClassComment,Squiz.Commenting.VariableComment src tests examples
1111

12-
test:
12+
test: tdd bdd
13+
14+
tdd:
1315
./vendor/bin/phpunit test
1416

1517
bdd:
16-
./vendor/bin/phpspec run --format=pretty
18+
./vendor/bin/phpspec run --format=pretty -v
1719

1820
cover:
1921
./vendor/bin/phpunit --coverage-html ./cover test

spec/Nats/ConnectionSpec.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function it_is_disconnected()
4141
$this->isConnected()->shouldBe(false);
4242
}
4343

44-
function it_can_connect_and_disconnect_with_default_options()
44+
function it_connects_and_disconnects_with_default_options()
4545
{
4646
$this->connect();
4747
$this->shouldHaveType('Nats\Connection');
@@ -59,7 +59,7 @@ function it_increases_reconnects_count_on_each_reconnection()
5959
$this->close();
6060
}
6161

62-
function it_a_ping_is_sent_after_a_successful_connection()
62+
function it_sends_ping_after_a_successful_connection()
6363
{
6464
$this->connect();
6565
$this->pingsCount()->shouldBe(1);
@@ -94,5 +94,30 @@ function it_decreases_subscriptions_after_unsubscribing_to_a_topic()
9494
$this->close();
9595
}
9696

97+
function it_sends_a_message_with_a_1024c_subject()
98+
{
99+
$this->connect();
100+
$subject = str_pad("", 1024*1, "x");
101+
$this->publish($subject);
102+
$this->pubsCount()->shouldBe(1);
103+
$this->close();
104+
}
105+
106+
function it_sends_a_message_with_a_1024x10c_subject()
107+
{
108+
$this->connect();
109+
$subject = str_pad("", 1024*10, "x");
110+
$this->publish($subject);
111+
$this->pubsCount()->shouldBe(1);
112+
$this->close();
113+
}
97114

115+
function it_sends_a_message_with_a_1024x100c_subject()
116+
{
117+
$this->connect();
118+
$subject = str_pad("", 1024*100, "x");
119+
$this->publish($subject);
120+
$this->pubsCount()->shouldBe(1);
121+
$this->close();
122+
}
98123
}

0 commit comments

Comments
 (0)