Skip to content

Commit 4896aac

Browse files
committed
Improve risky tests to contain rudimentary assertions
1 parent 908f2f5 commit 4896aac

6 files changed

Lines changed: 28 additions & 20 deletions

File tree

tests/IntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ public function testSelfSignedResolvesIfVerificationIsDisabled()
163163

164164
$conn = Block\await($connector->connect('tls://self-signed.badssl.com:443'), $loop, self::TIMEOUT);
165165
$conn->close();
166+
167+
// if we reach this, then everything is good
168+
$this->assertNull(null);
166169
}
167170

168171
public function testCancelPendingConnection()

tests/SecureIntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public function testConnectToServer()
5151
/* @var $client ConnectionInterface */
5252

5353
$client->close();
54+
55+
// if we reach this, then everything is good
56+
$this->assertNull(null);
5457
}
5558

5659
public function testConnectToServerEmitsConnection()

tests/ServerTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ class ServerTest extends TestCase
1313
{
1414
const TIMEOUT = 0.1;
1515

16-
public function testCreateServer()
16+
public function testCreateServerWithZeroPortAssignsRandomPort()
1717
{
1818
$loop = Factory::create();
1919

2020
$server = new Server(0, $loop);
21+
$this->assertNotEquals(0, $server->getAddress());
22+
$server->close();
2123
}
2224

2325
/**
@@ -80,7 +82,7 @@ public function testDoesNotEmitConnectionForNewConnectionToPausedServer()
8082

8183
$server = new Server(0, $loop);
8284
$server->pause();
83-
85+
$server->on('connection', $this->expectCallableNever());
8486

8587
$client = stream_socket_client($server->getAddress());
8688

tests/TcpConnectorTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,6 @@ public function connectionToInvalidSchemeShouldFailImmediately()
174174
);
175175
}
176176

177-
/** @test */
178-
public function connectionWithInvalidContextShouldFailImmediately()
179-
{
180-
$this->markTestIncomplete();
181-
182-
$loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
183-
184-
$connector = new TcpConnector($loop, array('bindto' => 'invalid.invalid:123456'));
185-
$connector->connect('127.0.0.1:80')->then(
186-
$this->expectCallableNever(),
187-
$this->expectCallableOnce()
188-
);
189-
}
190-
191177
/** @test */
192178
public function cancellingConnectionShouldRejectPromise()
193179
{

tests/TcpServerTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ public function testLoopWillEndWhenServerIsClosed()
107107
$this->server = null;
108108

109109
$this->loop->run();
110+
111+
// if we reach this, then everything is good
112+
$this->assertNull(null);
110113
}
111114

112115
public function testCloseTwiceIsNoOp()
113116
{
114117
$this->server->close();
115118
$this->server->close();
119+
120+
// if we reach this, then everything is good
121+
$this->assertNull(null);
116122
}
117123

118124
public function testGetAddressAfterCloseReturnsNull()
@@ -136,6 +142,9 @@ public function testLoopWillEndWhenServerIsClosedAfterSingleConnection()
136142
});
137143

138144
$this->loop->run();
145+
146+
// if we reach this, then everything is good
147+
$this->assertNull(null);
139148
}
140149

141150
public function testDataWillBeEmittedInMultipleChunksWhenClientSendsExcessiveAmounts()

tests/UnixServerTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,18 @@ public function testLoopWillEndWhenServerIsClosed()
100100
$this->server = null;
101101

102102
$this->loop->run();
103+
104+
// if we reach this, then everything is good
105+
$this->assertNull(null);
103106
}
104107

105108
public function testCloseTwiceIsNoOp()
106109
{
107110
$this->server->close();
108111
$this->server->close();
112+
113+
// if we reach this, then everything is good
114+
$this->assertNull(null);
109115
}
110116

111117
public function testGetAddressAfterCloseReturnsNull()
@@ -129,6 +135,9 @@ public function testLoopWillEndWhenServerIsClosedAfterSingleConnection()
129135
});
130136

131137
$this->loop->run();
138+
139+
// if we reach this, then everything is good
140+
$this->assertNull(null);
132141
}
133142

134143
public function testDataWillBeEmittedInMultipleChunksWhenClientSendsExcessiveAmounts()
@@ -164,9 +173,6 @@ public function testDataWillBeEmittedInMultipleChunksWhenClientSendsExcessiveAmo
164173
$this->assertEquals($bytes, $received);
165174
}
166175

167-
/**
168-
* @covers React\EventLoop\StreamSelectLoop::tick
169-
*/
170176
public function testConnectionDoesNotEndWhenClientDoesNotClose()
171177
{
172178
$client = stream_socket_client($this->uds);
@@ -181,7 +187,6 @@ public function testConnectionDoesNotEndWhenClientDoesNotClose()
181187
}
182188

183189
/**
184-
* @covers React\EventLoop\StreamSelectLoop::tick
185190
* @covers React\Socket\Connection::end
186191
*/
187192
public function testConnectionDoesEndWhenClientCloses()

0 commit comments

Comments
 (0)