diff options
author | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
---|---|---|
committer | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
commit | cf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch) | |
tree | 86700651aa180026e89a66064b0364b1e4346f3f /assets/php/vendor/react/socket/tests/TimeoutConnectorTest.php | |
parent | 619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff) |
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'assets/php/vendor/react/socket/tests/TimeoutConnectorTest.php')
-rwxr-xr-x | assets/php/vendor/react/socket/tests/TimeoutConnectorTest.php | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/assets/php/vendor/react/socket/tests/TimeoutConnectorTest.php b/assets/php/vendor/react/socket/tests/TimeoutConnectorTest.php deleted file mode 100755 index 64787d9..0000000 --- a/assets/php/vendor/react/socket/tests/TimeoutConnectorTest.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php - -namespace React\Tests\Socket; - -use React\Socket\TimeoutConnector; -use React\Promise; -use React\EventLoop\Factory; - -class TimeoutConnectorTest extends TestCase -{ - public function testRejectsOnTimeout() - { - $promise = new Promise\Promise(function () { }); - - $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); - $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); - - $loop = Factory::create(); - - $timeout = new TimeoutConnector($connector, 0.01, $loop); - - $timeout->connect('google.com:80')->then( - $this->expectCallableNever(), - $this->expectCallableOnce() - ); - - $loop->run(); - } - - public function testRejectsWhenConnectorRejects() - { - $promise = Promise\reject(new \RuntimeException()); - - $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); - $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); - - $loop = Factory::create(); - - $timeout = new TimeoutConnector($connector, 5.0, $loop); - - $timeout->connect('google.com:80')->then( - $this->expectCallableNever(), - $this->expectCallableOnce() - ); - - $loop->run(); - } - - public function testResolvesWhenConnectorResolves() - { - $promise = Promise\resolve(); - - $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); - $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); - - $loop = Factory::create(); - - $timeout = new TimeoutConnector($connector, 5.0, $loop); - - $timeout->connect('google.com:80')->then( - $this->expectCallableOnce(), - $this->expectCallableNever() - ); - - $loop->run(); - } - - public function testRejectsAndCancelsPendingPromiseOnTimeout() - { - $promise = new Promise\Promise(function () { }, $this->expectCallableOnce()); - - $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); - $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); - - $loop = Factory::create(); - - $timeout = new TimeoutConnector($connector, 0.01, $loop); - - $timeout->connect('google.com:80')->then( - $this->expectCallableNever(), - $this->expectCallableOnce() - ); - - $loop->run(); - } - - public function testCancelsPendingPromiseOnCancel() - { - $promise = new Promise\Promise(function () { }, function () { throw new \Exception(); }); - - $connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock(); - $connector->expects($this->once())->method('connect')->with('google.com:80')->will($this->returnValue($promise)); - - $loop = Factory::create(); - - $timeout = new TimeoutConnector($connector, 0.01, $loop); - - $out = $timeout->connect('google.com:80'); - $out->cancel(); - - $out->then($this->expectCallableNever(), $this->expectCallableOnce()); - } -} |