SocketTest.php 876 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Lithium: the most rad php framework
  4. *
  5. * @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
  6. * @license http://opensource.org/licenses/bsd-license.php The BSD License
  7. */
  8. namespace lithium\tests\cases\net;
  9. use lithium\tests\mocks\net\http\MockSocket;
  10. use lithium\net\http\Request;
  11. use lithium\net\http\Response;
  12. class SocketTest extends \lithium\test\Unit {
  13. public function testInitialization() {
  14. $socket = new MockSocket();
  15. $socket->open(array('test' => true));
  16. $config = $socket->config();
  17. $this->assertTrue($config['test']);
  18. }
  19. public function testSend() {
  20. $socket = new MockSocket();
  21. $message = new Request();
  22. $response = $socket->send($message, array('response' => 'lithium\net\http\Response'));
  23. $this->assertTrue($response instanceof Response);
  24. $this->assertTrue($socket->data instanceof Request);
  25. }
  26. }
  27. ?>