public function setUp() { parent::setUp(); $this->_mainConfig = $this->getMockBuilder('\\Erebot\\Interfaces\\Config\\Main')->getMock(); $this->_bot = $this->getMockBuilder('\\Erebot\\Interfaces\\Core')->setConstructorArgs(array($this->_mainConfig))->getMock(); // Create two connected stream-oriented TCP sockets. // We can't use stream_socket_pair() as it doesn't exist on Windows // until PHP 5.3.0 and, at least on my computer, it doesn't work with // the PF_INET protocol family. $server = stream_socket_server("tcp://127.0.0.1:0", $errno, $errstr); $client = stream_socket_client("tcp://127.0.0.1" . strrchr(stream_socket_get_name($server, FALSE), ":"), $errno, $errstr, 10, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); $accepted = stream_socket_accept($server); fclose($server); $this->assertTrue(stream_set_blocking($client, 1)); // Finish the rest of the preparations // (by creating connection objets). $this->_sockets = array($accepted, $client); $this->_worker = new \Erebot\Identd\Worker($this->_bot, $this->_sockets[0]); $this->_connection = new Erebot_Identd_Worker_TestStub($this->_bot, $this->_sockets[1]); $this->_bot->expects($this->any())->method('getConnections')->will($this->returnValue(array($this->_connection))); }
public function setUp() { parent::setUp(); \Erebot\Patches::patch(); $this->_translator = new \Erebot\Intl('Erebot\\Core'); }