Skip to content

Commit d67650c

Browse files
committed
Merge branch 'tests'
2 parents 541a1d9 + 2139cc9 commit d67650c

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

tests/SocketTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,31 @@ public function testClientEndAgainWillNotBlock(Socket $client)
6060
{
6161
$client->end();
6262
$this->loop->run();
63+
64+
return $client;
65+
}
66+
67+
/**
68+
*
69+
* @param Socket $client
70+
* @depends testClientEndAgainWillNotBlock
71+
*/
72+
public function testClientSendAfterEndIsNoop(Socket $client)
73+
{
74+
$client->send('does not matter');
75+
$this->loop->run();
76+
}
77+
78+
public function testClientSendHugeWillFail()
79+
{
80+
$promise = $this->factory->createClient('127.0.0.1', 12345);
81+
$client = $this->getValueFromResolvedPromise($promise);
82+
83+
$client->send(str_repeat(1, 1024 * 1024));
84+
$client->on('error', $this->expectCallableOnce());
85+
$client->end();
86+
87+
$this->loop->run();
6388
}
6489

6590
public function testCreatePair()

tests/bootstrap.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function expectCallableNever()
4848

4949
protected function createCallableMock()
5050
{
51-
return $this->getMock('React\Tests\Socket\Stub\CallableStub');
51+
return $this->getMock('CallableStub');
5252
}
5353

5454
protected function createResolverMock()
@@ -58,3 +58,10 @@ protected function createResolverMock()
5858
->getMock();
5959
}
6060
}
61+
62+
class CallableStub
63+
{
64+
public function __invoke()
65+
{
66+
}
67+
}

0 commit comments

Comments
 (0)