/** * @test */ public function authForWriteTestErrorResponse() { $this->_writeStream->setResponse("1\t125"); $result = $this->_driver->auth(Ext_HandlerSocket_Driver::MODE_WRITE, 'test'); $this->assertEquals("A\t1\ttest", $this->_writeStream->getLastRequest()); $this->assertFalse($result); }
public function getDriver($auth = true) { if (is_null($this->_driver)) { $readOptions = $this->getReadOptions(); $writeOptions = $this->getWriteOptions(); $driverReadOptions = array('host' => $readOptions['host'], 'port' => $readOptions['port']); $driverWriteOptions = array('host' => $writeOptions['host'], 'port' => $writeOptions['port']); $this->_driver = new Ext_HandlerSocket_Driver($driverReadOptions, $driverWriteOptions); if ($auth && isset($readOptions['authKey'])) { $this->_driver->auth(Ext_HandlerSocket_Driver::MODE_READ, $readOptions['authKey'], $readOptions['authType']); } if ($auth && isset($writeOptions['authKey'])) { $this->_driver->auth(Ext_HandlerSocket_Driver::MODE_WRITE, $writeOptions['authKey'], $writeOptions['authType']); } } return $this->_driver; }