Ejemplo n.º 1
0
 function testSelectReturnsLibeventReactorIfExtensionLoaded()
 {
     if (!extension_loaded('libevent')) {
         $this->markTestSkipped('libevent extension not available');
     }
     $rf = new ReactorFactory();
     $reactor = $rf->select();
     $this->assertInstanceOf('Alert\\LibeventReactor', $reactor);
 }
Ejemplo n.º 2
0
 public function __construct(Reactor $reactor = null, CookieJar $cookieJar = null, HttpSocketPool $socketPool = null, Encryptor $encryptor = null, WriterFactory $writerFactory = null)
 {
     $reactor = $reactor ?: ReactorFactory::select();
     $this->reactor = $reactor;
     $this->cookieJar = $cookieJar ?: new ArrayCookieJar();
     $this->socketPool = $socketPool ?: new HttpSocketPool($reactor);
     $this->encryptor = $encryptor ?: new Encryptor($reactor);
     $this->writerFactory = $writerFactory ?: new WriterFactory();
     $this->hasZlib = extension_loaded('zlib');
 }