예제 #1
0
 /**
  * Setup this test case
  *
  */
 public function setUp()
 {
     if (!Runtime::getInstance()->extensionAvailable('sockets')) {
         throw new PrerequisitesNotMetError('Sockets extension not available', NULL, array('ext/sockets'));
     }
     parent::setUp();
 }
 public static function startServer()
 {
     // Start server process
     with($rt = Runtime::getInstance());
     self::$serverProcess = $rt->getExecutable()->newInstance(array_merge($rt->startupOptions()->asArguments(), array($rt->bootstrapScript('class')), array('net.xp_framework.unittest.peer.sockets.TestingServer')));
     self::$serverProcess->in->close();
     // Check if startup succeeded
     $status = self::$serverProcess->out->readLine();
     if (2 != sscanf($status, '+ Service %[0-9.]:%d', self::$bindAddress[0], self::$bindAddress[1])) {
         try {
             self::shutdownServer();
         } catch (IllegalStateException $e) {
             $status .= $e->getMessage();
         }
         throw new PrerequisitesNotMetError('Cannot start server: ' . $status, NULL);
     }
 }