From 10da7e49206ab2a6a3a68027afbad6e5a019e0f8 Mon Sep 17 00:00:00 2001 From: Mike Almond Date: Wed, 1 Feb 2012 13:17:51 -0500 Subject: [PATCH] [TESTS] Fixing unit tests for versions Adding a unit test for Hixie and fixing the unit test for RFC --- .../WebSocket/Version/Hixie76Test.php | 19 +++++++++++++++++++ .../WebSocket/Version/RFC6455Test.php | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/Ratchet/Tests/Application/WebSocket/Version/Hixie76Test.php b/tests/Ratchet/Tests/Application/WebSocket/Version/Hixie76Test.php index 58a6245..bf5aa4d 100644 --- a/tests/Ratchet/Tests/Application/WebSocket/Version/Hixie76Test.php +++ b/tests/Ratchet/Tests/Application/WebSocket/Version/Hixie76Test.php @@ -30,4 +30,23 @@ class Hixie76Test extends \PHPUnit_Framework_TestCase { , array('', '') ); } + + /** + * @dataProvider KeyProvider + */ + public function testKeySigningForHandshake($accept, $key) { + $this->assertEquals($accept, $this->_version->generateKeyNumber($key)); + } + + + public static function KeyProvider() { + return array( + array('179922739', '17 9 G`ZD9 2 2b 7X 3 /r90') + , array('', '17 9 G`ZD9 2 2b 7X 3 /r91') + , array('906585445', '3e6b263 4 17 80') + , array('', '3e6b263 4 17 80') + , array('', '3e6b63 4 17 80') + , array('', '3e6b6341780') + ); + } } \ No newline at end of file diff --git a/tests/Ratchet/Tests/Application/WebSocket/Version/RFC6455Test.php b/tests/Ratchet/Tests/Application/WebSocket/Version/RFC6455Test.php index f32f59f..4e696ab 100644 --- a/tests/Ratchet/Tests/Application/WebSocket/Version/RFC6455Test.php +++ b/tests/Ratchet/Tests/Application/WebSocket/Version/RFC6455Test.php @@ -119,7 +119,7 @@ class RFC6455Test extends \PHPUnit_Framework_TestCase { $request = RequestFactory::fromMessage($header); if ($pass) { - $this->assertTrue(is_array($this->_version->handshake($request))); + $this->assertInstanceOf('\\Guzzle\\Http\\Message\\Response', $this->_version->handshake($request)); } else { $this->setExpectedException('InvalidArgumentException'); $this->_version->handshake($request);