Skip to content

Commit

Permalink
Bump PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Jan 16, 2023
1 parent 31c14f3 commit 6345385
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 42 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
dependencies:
- "highest"
include:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.phpunit.result.cache
phpunit.xml
reports
sandbox
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
}
, "require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "^9.3 || ^5.7"
}
}
6 changes: 0 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
</testsuite>
</testsuites>

<testsuites>
<testsuite name="integration">
<directory>./tests/integration/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
Expand Down
6 changes: 4 additions & 2 deletions tests/helpers/Ratchet/AbstractMessageComponentTestCase.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
namespace Ratchet;

abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestCase {
use PHPUnit\Framework\TestCase;

abstract class AbstractMessageComponentTestCase extends TestCase {
protected $_app;
protected $_serv;
protected $_conn;
Expand All @@ -10,7 +12,7 @@ abstract public function getConnectionClassString();
abstract public function getDecoratorClassString();
abstract public function getComponentClassString();

public function setUp() {
public function before() {
$this->_app = $this->getMock($this->getComponentClassString());
$decorator = $this->getDecoratorClassString();
$this->_serv = new $decorator($this->_app);
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/AbstractConnectionDecoratorTest.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php
namespace Ratchet;
use PHPUnit\Framework\TestCase;
use Ratchet\Mock\ConnectionDecorator;

/**
* @covers Ratchet\AbstractConnectionDecorator
* @covers Ratchet\ConnectionInterface
*/
class AbstractConnectionDecoratorTest extends \PHPUnit_Framework_TestCase {
class AbstractConnectionDecoratorTest extends TestCase {
protected $mock;
protected $l1;
protected $l2;

public function setUp() {
public function before() {
$this->mock = $this->getMock('\Ratchet\ConnectionInterface');
$this->l1 = new ConnectionDecorator($this->mock);
$this->l2 = new ConnectionDecorator($this->l1);
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/Http/HttpRequestParserTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php
namespace Ratchet\Http;

use PHPUnit\Framework\TestCase;

/**
* @covers Ratchet\Http\HttpRequestParser
*/
class HttpRequestParserTest extends \PHPUnit_Framework_TestCase {
class HttpRequestParserTest extends TestCase {
protected $parser;

public function setUp() {
public function before() {
$this->parser = new HttpRequestParser;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Http/HttpServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @covers Ratchet\Http\HttpServer
*/
class HttpServerTest extends AbstractMessageComponentTestCase {
public function setUp() {
parent::setUp();
public function before() {
parent::before();
$this->_conn->httpHeadersReceived = true;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Http/OriginCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class OriginCheckTest extends AbstractMessageComponentTestCase {
protected $_reqStub;

public function setUp() {
public function before() {
$this->_reqStub = $this->getMock('Psr\Http\Message\RequestInterface');
$this->_reqStub->expects($this->any())->method('getHeader')->will($this->returnValue(['localhost']));

Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Http/RouterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Ratchet\Http;
use PHPUnit\Framework\TestCase;
use Ratchet\WebSocket\WsServerInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
Expand All @@ -11,14 +12,14 @@
/**
* @covers Ratchet\Http\Router
*/
class RouterTest extends \PHPUnit_Framework_TestCase {
class RouterTest extends TestCase {
protected $_router;
protected $_matcher;
protected $_conn;
protected $_uri;
protected $_req;

public function setUp() {
public function before() {
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_uri = $this->getMock('Psr\Http\Message\UriInterface');
$this->_req = $this->getMock('\Psr\Http\Message\RequestInterface');
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Server/EchoServerTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php
namespace Ratchet\Server;
use PHPUnit\Framework\TestCase;
use Ratchet\Server\EchoServer;

class EchoServerTest extends \PHPUnit_Framework_TestCase {
class EchoServerTest extends TestCase {
protected $_conn;
protected $_comp;

public function setUp() {
public function before() {
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_comp = new EchoServer;
}
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Server/FlashPolicyComponentTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php
namespace Ratchet\Application\Server;
use PHPUnit\Framework\TestCase;
use Ratchet\Server\FlashPolicy;

/**
* @covers Ratchet\Server\FlashPolicy
*/
class FlashPolicyTest extends \PHPUnit_Framework_TestCase {
class FlashPolicyTest extends TestCase {

protected $_policy;

public function setUp() {
public function before() {
$this->_policy = new FlashPolicy();
}

Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Server/IoConnectionTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php
namespace Ratchet\Application\Server;
use PHPUnit\Framework\TestCase;
use Ratchet\Server\IoConnection;

/**
* @covers Ratchet\Server\IoConnection
*/
class IoConnectionTest extends \PHPUnit_Framework_TestCase {
class IoConnectionTest extends TestCase {
protected $sock;
protected $conn;

public function setUp() {
public function before() {
$this->sock = $this->getMock('\\React\\Socket\\ConnectionInterface');
$this->conn = new IoConnection($this->sock);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Server/IoServerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Ratchet\Server;
use PHPUnit\Framework\TestCase;
use Ratchet\Server\IoServer;
use React\EventLoop\StreamSelectLoop;
use React\EventLoop\LoopInterface;
Expand All @@ -8,7 +9,7 @@
/**
* @covers Ratchet\Server\IoServer
*/
class IoServerTest extends \PHPUnit_Framework_TestCase {
class IoServerTest extends TestCase {
protected $server;

protected $app;
Expand All @@ -25,7 +26,7 @@ protected function tickLoop(LoopInterface $loop) {
$loop->run();
}

public function setUp() {
public function before() {
$this->app = $this->getMock('\\Ratchet\\MessageComponentInterface');

$loop = new StreamSelectLoop;
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Server/IpBlackListComponentTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php
namespace Ratchet\Server;
use PHPUnit\Framework\TestCase;
use Ratchet\Server\IpBlackList;

/**
* @covers Ratchet\Server\IpBlackList
*/
class IpBlackListTest extends \PHPUnit_Framework_TestCase {
class IpBlackListTest extends TestCase {
protected $blocker;
protected $mock;

public function setUp() {
public function before() {
$this->mock = $this->getMock('\\Ratchet\\MessageComponentInterface');
$this->blocker = new IpBlackList($this->mock);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Session/Serialize/PhpHandlerTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php
namespace Ratchet\Session\Serialize;
use PHPUnit\Framework\TestCase;
use Ratchet\Session\Serialize\PhpHandler;

/**
* @covers Ratchet\Session\Serialize\PhpHandler
*/
class PhpHandlerTest extends \PHPUnit_Framework_TestCase {
class PhpHandlerTest extends TestCase {
protected $_handler;

public function setUp() {
public function before() {
$this->_handler = new PhpHandler;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Session/SessionComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @covers Ratchet\Session\Storage\Proxy\VirtualProxy
*/
class SessionProviderTest extends AbstractMessageComponentTestCase {
public function setUp() {
public function before() {
return $this->markTestIncomplete('Test needs to be updated for ini_set issue in PHP 7.2');

if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) {
Expand All @@ -21,7 +21,7 @@ public function setUp() {
$this->_serv = new SessionProvider($this->_app, new NullSessionHandler);
}

public function tearDown() {
public function after() {
ini_set('session.serialize_handler', 'php');
}

Expand Down
7 changes: 4 additions & 3 deletions tests/unit/Session/Storage/VirtualSessionStoragePDOTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?php
namespace Ratchet\Session\Storage;
use PHPUnit\Framework\TestCase;
use Ratchet\Session\Serialize\PhpHandler;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;

class VirtualSessionStoragePDOTest extends \PHPUnit_Framework_TestCase {
class VirtualSessionStoragePDOTest extends TestCase {
/**
* @var VirtualSessionStorage
*/
protected $_virtualSessionStorage;

protected $_pathToDB;

public function setUp() {
public function before() {
if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) {
return $this->markTestSkipped('Session test requires PDO and pdo_sqlite');
}
Expand Down Expand Up @@ -41,7 +42,7 @@ public function setUp() {
$this->_virtualSessionStorage->registerBag(new AttributeBag());
}

public function tearDown() {
public function after() {
unlink($this->_pathToDB);
}

Expand Down
5 changes: 3 additions & 2 deletions tests/unit/Wamp/ServerProtocolTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Ratchet\Wamp;
use PHPUnit\Framework\TestCase;
use Ratchet\Mock\Connection;
use Ratchet\Mock\WampComponent as TestComponent;

Expand All @@ -8,12 +9,12 @@
* @covers \Ratchet\Wamp\WampServerInterface
* @covers \Ratchet\Wamp\WampConnection
*/
class ServerProtocolTest extends \PHPUnit_Framework_TestCase {
class ServerProtocolTest extends TestCase {
protected $_comp;

protected $_app;

public function setUp() {
public function before() {
$this->_app = new TestComponent;
$this->_comp = new ServerProtocol($this->_app);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/Wamp/TopicManagerTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php
namespace Ratchet\Wamp;

use PHPUnit\Framework\TestCase;

/**
* @covers Ratchet\Wamp\TopicManager
*/
class TopicManagerTest extends \PHPUnit_Framework_TestCase {
class TopicManagerTest extends TestCase {
private $mock;

/**
Expand All @@ -17,7 +19,7 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
*/
private $conn;

public function setUp() {
public function before() {
$this->conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->mock = $this->getMock('\Ratchet\Wamp\WampServerInterface');
$this->mngr = new TopicManager($this->mock);
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/Wamp/TopicTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php
namespace Ratchet\Wamp;

use PHPUnit\Framework\TestCase;

/**
* @covers Ratchet\Wamp\Topic
*/
class TopicTest extends \PHPUnit_Framework_TestCase {
class TopicTest extends TestCase {
public function testGetId() {
$id = uniqid();
$topic = new Topic($id);
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/Wamp/WampConnectionTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php
namespace Ratchet\Wamp;

use PHPUnit\Framework\TestCase;

/**
* @covers Ratchet\Wamp\WampConnection
*/
class WampConnectionTest extends \PHPUnit_Framework_TestCase {
class WampConnectionTest extends TestCase {
protected $conn;
protected $mock;

public function setUp() {
public function before() {
$this->mock = $this->getMock('\\Ratchet\\ConnectionInterface');
$this->conn = new WampConnection($this->mock);
}
Expand Down

0 comments on commit 6345385

Please sign in to comment.