From 8b475d2649468ad41cc4aa24339d21883175208f Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Thu, 22 Oct 2015 00:31:45 +0300 Subject: [PATCH] Add timeout and not connected test --- Tests/Tests.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/Tests/Tests.php b/Tests/Tests.php index 0aae42d..f2864fc 100644 --- a/Tests/Tests.php +++ b/Tests/Tests.php @@ -71,6 +71,53 @@ public function tearDown() { $this->SourceQuery->Disconnect(); + + unset( $this->SourceQuery ); + } + + /** + * @expectedException xPaw\SourceQuery\Exception\InvalidArgumentException + */ + public function testInvalidTimeout() + { + $SourceQuery = new SourceQuery( ); + $SourceQuery->Connect( 1, 2, -1 ); + } + + /** + * @expectedException xPaw\SourceQuery\Exception\SocketException + */ + public function testNotConnectedGetInfo() + { + $this->SourceQuery->Disconnect(); + $this->SourceQuery->GetInfo(); + } + + /** + * @expectedException xPaw\SourceQuery\Exception\SocketException + */ + public function testNotConnectedPing() + { + $this->SourceQuery->Disconnect(); + $this->SourceQuery->Ping(); + } + + /** + * @expectedException xPaw\SourceQuery\Exception\SocketException + */ + public function testNotConnectedGetPlayers() + { + $this->SourceQuery->Disconnect(); + $this->SourceQuery->GetPlayers(); + } + + /** + * @expectedException xPaw\SourceQuery\Exception\SocketException + */ + public function testNotConnectedGetRules() + { + $this->SourceQuery->Disconnect(); + $this->SourceQuery->GetRules(); } /**