start() public method

public start ( callable $callback = null )
$callback callable
コード例 #1
0
 private function startHttpMock()
 {
     echo "Starting http mock server on {$this->config['host']}:{$this->config['port']}" . PHP_EOL;
     $this->server = new Server($this->config['port'], $this->config['host']);
     $this->server->start();
     $this->setUpDependencyInjection();
 }
コード例 #2
0
 public function setUp()
 {
     $this->matches = new MatcherFactory();
     $this->builder = new MockBuilder($this->matches, new ExtractorFactory());
     $this->server = new Server(HTTP_MOCK_PORT, HTTP_MOCK_HOST);
     $this->server->start();
     $this->server->clean();
 }
コード例 #3
0
 /**
  * Gets the mocked HTTP server.
  *
  * Initializes the server if it was not used before.
  * By default it responds to any POST requests to /invalidate with 200 OK,
  * additional behavior can be added in further steps.
  *
  * @return Server
  *   The mocked HTTP server.
  */
 protected function getServer()
 {
     if (!$this->server) {
         $this->server = new Server($this->mockServerPort, 'localhost');
         $this->server->start();
         // Accept any POSTS.
         $mock = new MockBuilder(new MatcherFactory(), new ExtractorFactory());
         $mock->when()->pathIs('/invalidate')->methodIs('POST')->then()->statusCode(200);
         $this->server->setUp($mock->flushExpectations());
     }
     return $this->server;
 }
コード例 #4
0
 public function __construct($port, $host, $basePath)
 {
     $server = new Server($port, $host);
     $server->start();
     $this->services['server'] = $server;
     $this->basePath = $basePath;
 }
コード例 #5
0
 public static function setUpBeforeClass()
 {
     static::$server1 = new Server(HTTP_MOCK_PORT, HTTP_MOCK_HOST);
     static::$server1->start();
 }