Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ringcentral/psr7": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^7.0 || ^5.0 || ^4.8",
"phpunit/phpunit": "^9.0 || ^7.0 || ^5.0 || ^4.8",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"clue/block-react": "^1.1"
}
Expand Down
14 changes: 14 additions & 0 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,19 @@ protected function createCallableMock()
{
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}

public function setExpectedException($exception, $message = '', $code = 0)
{
if (method_exists($this, 'expectException')) {
$this->expectException($exception);
if ($message !== '') {
$this->expectExceptionMessage($message);
}
$this->expectExceptionCode($code);
} else {
parent::setExpectedException($exception, $message, $code);
}
}

}

5 changes: 4 additions & 1 deletion tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class FunctionalTest extends AbstractTestCase
private $tcpConnector;
private $dnsConnector;

public function setUp()
/**
* @before
*/
public function setUpConnector()
{
$this->loop = Factory::create();

Expand Down
17 changes: 7 additions & 10 deletions tests/ProxyConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@ class ProxyConnectorTest extends AbstractTestCase
{
private $connector;

public function setUp()
/**
* @before
*/
public function setUpMock()
{
$this->connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock();
}

/**
* @expectedException InvalidArgumentException
*/
public function testInvalidProxy()
{
$this->setExpectedException('InvalidArgumentException');
new ProxyConnector('///', $this->connector);
}

/**
* @expectedException InvalidArgumentException
*/
public function testInvalidProxyScheme()
{
$this->setExpectedException('InvalidArgumentException');
new ProxyConnector('ftp://example.com', $this->connector);
}

/**
* @expectedException InvalidArgumentException
*/
public function testInvalidHttpsUnixScheme()
{
$this->setExpectedException('InvalidArgumentException');
new ProxyConnector('https+unix:///tmp/proxy.sock', $this->connector);
}

Expand Down