| @@ 32-145 (lines=114) @@ | ||
| 29 | * WEB_SERVER_PORT port to listen on (required) |
|
| 30 | * WEB_SERVER_DOCROOT path to the document root for the server (required) |
|
| 31 | */ |
|
| 32 | class WebServerListener implements TestListener |
|
| 33 | { |
|
| 34 | /** @var WebServerListenerTrait */ |
|
| 35 | private $trait; |
|
| 36 | ||
| 37 | public function __construct() |
|
| 38 | { |
|
| 39 | $this->trait = new WebServerListenerTrait(); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Make sure the PHP built-in web server is running for tests with group |
|
| 44 | * 'webserver'. |
|
| 45 | */ |
|
| 46 | public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) |
|
| 47 | { |
|
| 48 | $this->trait->startTestSuite($suite); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * We don't need these. |
|
| 53 | */ |
|
| 54 | public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) |
|
| 55 | { |
|
| 56 | } |
|
| 57 | ||
| 58 | public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
| 59 | { |
|
| 60 | } |
|
| 61 | ||
| 62 | public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) |
|
| 63 | { |
|
| 64 | } |
|
| 65 | ||
| 66 | public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
| 67 | { |
|
| 68 | } |
|
| 69 | ||
| 70 | public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
| 71 | { |
|
| 72 | } |
|
| 73 | ||
| 74 | public function startTest(\PHPUnit_Framework_Test $test) |
|
| 75 | { |
|
| 76 | } |
|
| 77 | ||
| 78 | public function endTest(\PHPUnit_Framework_Test $test, $time) |
|
| 79 | { |
|
| 80 | } |
|
| 81 | ||
| 82 | public function addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) |
|
| 83 | { |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Get web server hostname. |
|
| 88 | * |
|
| 89 | * @throws \Exception |
|
| 90 | * |
|
| 91 | * @return string |
|
| 92 | */ |
|
| 93 | protected function getHostName() |
|
| 94 | { |
|
| 95 | return $this->trait->getHostName(); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * Get web server port. |
|
| 100 | * |
|
| 101 | * @throws \Exception |
|
| 102 | * |
|
| 103 | * @return int |
|
| 104 | */ |
|
| 105 | protected function getPort() |
|
| 106 | { |
|
| 107 | return $this->trait->getPort(); |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * Get web server port. |
|
| 112 | * |
|
| 113 | * @throws \Exception |
|
| 114 | * |
|
| 115 | * @return int |
|
| 116 | */ |
|
| 117 | protected function getDocRoot() |
|
| 118 | { |
|
| 119 | return $this->trait->getDocRoot(); |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * Start PHP built-in web server. |
|
| 124 | * |
|
| 125 | * @return int PID |
|
| 126 | */ |
|
| 127 | protected function startPhpWebServer() |
|
| 128 | { |
|
| 129 | return $this->trait->startPhpWebServer(); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * Wait for caching proxy to be started up and reachable. |
|
| 134 | * |
|
| 135 | * @param string $ip |
|
| 136 | * @param int $port |
|
| 137 | * @param int $timeout Timeout in milliseconds |
|
| 138 | * |
|
| 139 | * @throws \RuntimeException If proxy is not reachable within timeout |
|
| 140 | */ |
|
| 141 | protected function waitFor($ip, $port, $timeout) |
|
| 142 | { |
|
| 143 | $this->trait->waitFor($ip, $port, $timeout); |
|
| 144 | } |
|
| 145 | } |
|
| 146 | ||
| @@ 36-153 (lines=118) @@ | ||
| 33 | * WEB_SERVER_PORT port to listen on (required) |
|
| 34 | * WEB_SERVER_DOCROOT path to the document root for the server (required) |
|
| 35 | */ |
|
| 36 | class WebServerListener6 implements TestListener |
|
| 37 | { |
|
| 38 | /** @var WebServerListenerTrait */ |
|
| 39 | private $trait; |
|
| 40 | ||
| 41 | public function __construct() |
|
| 42 | { |
|
| 43 | $this->trait = new WebServerListenerTrait(); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Make sure the PHP built-in web server is running for tests with group |
|
| 48 | * 'webserver'. |
|
| 49 | */ |
|
| 50 | public function startTestSuite(TestSuite $suite) |
|
| 51 | { |
|
| 52 | $this->trait->startTestSuite($suite); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * We don't need these. |
|
| 57 | */ |
|
| 58 | public function endTestSuite(TestSuite $suite) |
|
| 59 | { |
|
| 60 | } |
|
| 61 | ||
| 62 | public function addError(Test $test, \Exception $e, $time) |
|
| 63 | { |
|
| 64 | } |
|
| 65 | ||
| 66 | public function addFailure(Test $test, AssertionFailedError $e, $time) |
|
| 67 | { |
|
| 68 | } |
|
| 69 | ||
| 70 | public function addIncompleteTest(Test $test, \Exception $e, $time) |
|
| 71 | { |
|
| 72 | } |
|
| 73 | ||
| 74 | public function addSkippedTest(Test $test, \Exception $e, $time) |
|
| 75 | { |
|
| 76 | } |
|
| 77 | ||
| 78 | public function startTest(Test $test) |
|
| 79 | { |
|
| 80 | } |
|
| 81 | ||
| 82 | public function endTest(Test $test, $time) |
|
| 83 | { |
|
| 84 | } |
|
| 85 | ||
| 86 | public function addRiskyTest(Test $test, \Exception $e, $time) |
|
| 87 | { |
|
| 88 | } |
|
| 89 | ||
| 90 | public function addWarning(Test $test, Warning $e, $time) |
|
| 91 | { |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Get web server hostname. |
|
| 96 | * |
|
| 97 | * @throws \Exception |
|
| 98 | * |
|
| 99 | * @return string |
|
| 100 | */ |
|
| 101 | protected function getHostName() |
|
| 102 | { |
|
| 103 | return $this->trait->getHostName(); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Get web server port. |
|
| 108 | * |
|
| 109 | * @throws \Exception |
|
| 110 | * |
|
| 111 | * @return int |
|
| 112 | */ |
|
| 113 | protected function getPort() |
|
| 114 | { |
|
| 115 | return $this->trait->getPort(); |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * Get web server port. |
|
| 120 | * |
|
| 121 | * @throws \Exception |
|
| 122 | * |
|
| 123 | * @return int |
|
| 124 | */ |
|
| 125 | protected function getDocRoot() |
|
| 126 | { |
|
| 127 | return $this->trait->getDocRoot(); |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * Start PHP built-in web server. |
|
| 132 | * |
|
| 133 | * @return int PID |
|
| 134 | */ |
|
| 135 | protected function startPhpWebServer() |
|
| 136 | { |
|
| 137 | return $this->trait->startPhpWebServer(); |
|
| 138 | } |
|
| 139 | ||
| 140 | /** |
|
| 141 | * Wait for caching proxy to be started up and reachable. |
|
| 142 | * |
|
| 143 | * @param string $ip |
|
| 144 | * @param int $port |
|
| 145 | * @param int $timeout Timeout in milliseconds |
|
| 146 | * |
|
| 147 | * @throws \RuntimeException If proxy is not reachable within timeout |
|
| 148 | */ |
|
| 149 | protected function waitFor($ip, $port, $timeout) |
|
| 150 | { |
|
| 151 | $this->trait->waitFor($ip, $port, $timeout); |
|
| 152 | } |
|
| 153 | } |
|
| 154 | ||