File: tests/socket-tests/ClientSocketTest.php

Recommend this page to a friend!
  Classes of Maik Greubel  >  PHP Generics  >  tests/socket-tests/ClientSocketTest.php  >  Download  
File: tests/socket-tests/ClientSocketTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Update to PHPUnit 6
Date: 3 years ago
Size: 836 bytes
 

Contents

Class file image Download
<?php

namespace Generics\Tests;

use
Generics\Socket\ClientSocket;
use
Generics\Socket\Endpoint;

class
ClientSocketTest extends \PHPUnit\Framework\TestCase
{

    public function
testClientSocketConnect()
    {
       
$client = new ClientSocket(new Endpoint('httpbin.org', 80));
       
$this->assertFalse($client->isConnected());
       
$this->assertFalse($client->isWriteable());
       
$client->connect();
       
$this->assertTrue($client->isConnected());
       
$this->assertTrue($client->isWriteable());
       
$client->close();
       
$this->assertFalse($client->ready());
    }

   
/**
     * @expectedException \Generics\Socket\SocketException
     */
   
public function testClientSocketConnectionFailed()
    {
       
$client = new ClientSocket(new Endpoint('127.0.0.1', 5555));
       
$client->connect();
    }
}


For more information send a message to info at phpclasses dot org.