1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of codeception-phiremock-extension. |
4
|
|
|
* |
5
|
|
|
* phiremock-codeception-extension is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* |
10
|
|
|
* phiremock-codeception-extension is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
* GNU General Public License for more details. |
14
|
|
|
* |
15
|
|
|
* You should have received a copy of the GNU General Public License |
16
|
|
|
* along with phiremock-codeception-extension. If not, see <http://www.gnu.org/licenses/>. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Mcustiel\Phiremock\Codeception\Extension; |
20
|
|
|
|
21
|
|
|
use Mcustiel\Phiremock\Client\Connection\Host; |
|
|
|
|
22
|
|
|
use Mcustiel\Phiremock\Client\Connection\Port; |
|
|
|
|
23
|
|
|
use Mcustiel\Phiremock\Client\Connection\Scheme; |
|
|
|
|
24
|
|
|
use Mcustiel\Phiremock\Client\Factory; |
|
|
|
|
25
|
|
|
use Mcustiel\Phiremock\Codeception\Extension\ReadinessChecker\CurlChecker; |
26
|
|
|
use Mcustiel\Phiremock\Codeception\Extension\ReadinessChecker\PhiremockClientChecker; |
27
|
|
|
|
28
|
|
|
class ReadinessCheckerFactory |
29
|
|
|
{ |
30
|
|
|
public static function create(string $host, string $port, bool $isSecure): ReadinessCheckerInterface |
31
|
|
|
{ |
32
|
|
|
if (class_exists(Factory::class)) { |
33
|
|
|
$phiremockClient = Factory::createDefault() |
34
|
|
|
->createPhiremockClient( |
35
|
|
|
new Host($host), |
36
|
|
|
new Port($port), |
37
|
|
|
$isSecure ? Scheme::createHttps() : Scheme::createHttp() |
38
|
|
|
); |
39
|
|
|
|
40
|
|
|
return new PhiremockClientChecker( |
41
|
|
|
$phiremockClient |
42
|
|
|
); |
43
|
|
|
} elseif (extension_loaded('curl')) { |
44
|
|
|
$url = 'http' . ($isSecure ? 's' : '') |
45
|
|
|
. '://' . $host |
46
|
|
|
. ($port !== '' ? ':' . $port : ''); |
47
|
|
|
|
48
|
|
|
return new CurlChecker($url); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
throw new \RuntimeException( |
52
|
|
|
'Config wait_until_ready is enabled but no readiness checker can be run. Check if you have Phiremock Client installed or curl extension enabled.' |
53
|
|
|
); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths