public static function setUpBeforeClass() { parent::setUpBeforeClass(); $server = new Server(); $server->start()->wait(); self::setDriver(new Browser($server->getClient())); }
/** * @covers ::start * @covers ::wait * @covers ::getWaitAttempt * @covers ::isStarted */ public function testStart() { $process = 'sleep .01 && echo "Started working" && echo "Some error message" >> /dev/stderr'; $logger = new TestLogger(); $server = new Server($process, $logger); $promise = $server->start(); $this->assertInstanceOf('GuzzleHttp\\Promise\\Promise', $promise, 'Start should return a promise object with wait method'); $this->assertFalse($server->isStarted(), 'The server must not be started yet, waiting for furst text response'); $promise->wait(); $this->assertTrue($server->isStarted(), 'The server should be started after the wait'); $expected = ["debug Started working\n", "error Some error message\n"]; $this->assertEquals($expected, $logger->getEntries(), 'Should have recorded the normal and error messages in the logger'); }