1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
||
5 | * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
||
6 | */ |
||
7 | |||
8 | namespace SprykerTest\Zed\Application; |
||
9 | |||
10 | use Codeception\Actor; |
||
11 | use Silex\Application; |
||
12 | use Spryker\Shared\Application\ApplicationConstants; |
||
13 | use Spryker\Zed\Application\Communication\Plugin\ServiceProvider\SslServiceProvider; |
||
14 | use Symfony\Component\HttpFoundation\Request; |
||
15 | |||
16 | /** |
||
17 | * @method void wantToTest($text) |
||
18 | * @method void wantTo($text) |
||
19 | * @method void execute($callable) |
||
20 | * @method void expectTo($prediction) |
||
21 | * @method void expect($prediction) |
||
22 | * @method void amGoingTo($argumentation) |
||
23 | * @method void am($role) |
||
24 | * @method void lookForwardTo($achieveValue) |
||
25 | * @method void comment($description) |
||
26 | * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) |
||
27 | * |
||
28 | * @method \Spryker\Zed\Application\Communication\ApplicationCommunicationFactory getFactory() |
||
29 | * |
||
30 | * @SuppressWarnings(PHPMD) |
||
31 | */ |
||
32 | class ApplicationCommunicationTester extends Actor |
||
33 | { |
||
34 | use _generated\ApplicationCommunicationTesterActions; |
||
35 | |||
36 | /** |
||
37 | * @param string $controllerResponse |
||
38 | * @param bool $isSslEnabled |
||
39 | * |
||
40 | * @return \Silex\Application |
||
41 | */ |
||
42 | public function getApplicationForSslTest(string $controllerResponse = '', bool $isSslEnabled = true): Application |
||
43 | { |
||
44 | $this->setConfig(ApplicationConstants::ZED_SSL_ENABLED, $isSslEnabled); |
||
45 | $this->setConfig(ApplicationConstants::ZED_TRUSTED_HOSTS, []); |
||
46 | |||
47 | $application = new Application(); |
||
48 | $application->register(new SslServiceProvider()); |
||
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||
49 | |||
50 | $application['controllers']->get('/foo', function () use ($controllerResponse) { |
||
51 | return $controllerResponse; |
||
52 | }); |
||
53 | |||
54 | return $application; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return \Symfony\Component\HttpFoundation\Request |
||
59 | */ |
||
60 | public function getRequestForSslTest(): Request |
||
61 | { |
||
62 | return Request::create('/foo'); |
||
63 | } |
||
64 | } |
||
65 |