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
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace SprykerTest\Zed\SearchHttp; |
11
|
|
|
|
12
|
|
|
use Codeception\Actor; |
13
|
|
|
use Generated\Shared\Transfer\SearchHttpConfigTransfer; |
14
|
|
|
use Generated\Shared\Transfer\StoreTransfer; |
15
|
|
|
use Orm\Zed\SearchHttp\Persistence\SpySearchHttpConfig; |
16
|
|
|
use Orm\Zed\SearchHttp\Persistence\SpySearchHttpConfigQuery; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Inherited Methods |
20
|
|
|
* |
21
|
|
|
* @method void wantToTest($text) |
22
|
|
|
* @method void wantTo($text) |
23
|
|
|
* @method void execute($callable) |
24
|
|
|
* @method void expectTo($prediction) |
25
|
|
|
* @method void expect($prediction) |
26
|
|
|
* @method void amGoingTo($argumentation) |
27
|
|
|
* @method void am($role) |
28
|
|
|
* @method void lookForwardTo($achieveValue) |
29
|
|
|
* @method void comment($description) |
30
|
|
|
* @method void pause($vars = []) |
31
|
|
|
* @method \Spryker\Zed\SearchHttp\Business\SearchHttpFacadeInterface getFacade() |
32
|
|
|
* |
33
|
|
|
* @SuppressWarnings(\SprykerTest\Zed\SearchHttp\PHPMD) |
34
|
|
|
*/ |
35
|
|
|
class SearchHttpBusinessTester extends Actor |
36
|
|
|
{ |
37
|
|
|
use _generated\SearchHttpBusinessTesterActions; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return void |
41
|
|
|
*/ |
42
|
|
|
public function ensureSearchHttpConfigTableIsEmpty(): void |
43
|
|
|
{ |
44
|
|
|
$this->ensureDatabaseTableIsEmpty($this->getSearchHttpConfigQuery()); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return \Orm\Zed\SearchHttp\Persistence\SpySearchHttpConfigQuery |
49
|
|
|
*/ |
50
|
|
|
protected function getSearchHttpConfigQuery(): SpySearchHttpConfigQuery |
51
|
|
|
{ |
52
|
|
|
return SpySearchHttpConfigQuery::create(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param string $storeName |
57
|
|
|
* |
58
|
|
|
* @return \Orm\Zed\SearchHttp\Persistence\SpySearchHttpConfig|null |
59
|
|
|
*/ |
60
|
|
|
public function findSearchHttpConfigByStoreName(string $storeName): ?SpySearchHttpConfig |
61
|
|
|
{ |
62
|
|
|
return $this->getSearchHttpConfigQuery() |
63
|
|
|
->filterByStore($storeName) |
64
|
|
|
->findOne(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param \Generated\Shared\Transfer\SearchHttpConfigTransfer $searchHttpConfigTransfer |
69
|
|
|
* @param \Orm\Zed\SearchHttp\Persistence\SpySearchHttpConfig|null $searchHttpConfigEntity |
70
|
|
|
* |
71
|
|
|
* @return void |
72
|
|
|
*/ |
73
|
|
|
public function assertSearchHttpConfigStoredProperly( |
74
|
|
|
SearchHttpConfigTransfer $searchHttpConfigTransfer, |
75
|
|
|
?SpySearchHttpConfig $searchHttpConfigEntity = null |
76
|
|
|
): void { |
77
|
|
|
$this->assertNotNull($searchHttpConfigEntity); |
78
|
|
|
$this->assertNotEmpty($searchHttpConfigEntity->getData()); |
|
|
|
|
79
|
|
|
$this->assertNotEmpty($searchHttpConfigEntity->getData()['search_http_configs']); |
80
|
|
|
$this->assertNotNull($searchHttpConfigEntity->getData()['search_http_configs'][0]['application_id']); |
81
|
|
|
$this->assertEquals( |
82
|
|
|
$searchHttpConfigTransfer->getApplicationId(), |
83
|
|
|
$searchHttpConfigEntity->getData()['search_http_configs'][0]['application_id'], |
84
|
|
|
); |
85
|
|
|
$this->assertNotNull($searchHttpConfigEntity->getData()['search_http_configs'][0]['url']); |
86
|
|
|
$this->assertEquals( |
87
|
|
|
$searchHttpConfigTransfer->getUrl(), |
88
|
|
|
$searchHttpConfigEntity->getData()['search_http_configs'][0]['url'], |
89
|
|
|
); |
90
|
|
|
$this->assertNotNull($searchHttpConfigEntity->getData()['search_http_configs'][0]['suggestion_url']); |
91
|
|
|
$this->assertEquals( |
92
|
|
|
$searchHttpConfigTransfer->getSuggestionUrl(), |
93
|
|
|
$searchHttpConfigEntity->getData()['search_http_configs'][0]['suggestion_url'], |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param \Orm\Zed\SearchHttp\Persistence\SpySearchHttpConfig|null $searchHttpConfigEntity |
99
|
|
|
* |
100
|
|
|
* @return void |
101
|
|
|
*/ |
102
|
|
|
public function assertSearchHttpConfigRemovedProperly( |
103
|
|
|
?SpySearchHttpConfig $searchHttpConfigEntity = null |
104
|
|
|
): void { |
105
|
|
|
$this->assertNotNull($searchHttpConfigEntity); |
106
|
|
|
$this->assertNotEmpty($searchHttpConfigEntity->getData()); |
107
|
|
|
$this->assertEquals([], $searchHttpConfigEntity->getData()['search_http_configs']); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return \Generated\Shared\Transfer\StoreTransfer |
112
|
|
|
*/ |
113
|
|
|
public function createStoreWithStoreReference(): StoreTransfer |
114
|
|
|
{ |
115
|
|
|
return (new StoreTransfer()) |
116
|
|
|
->setName('test_store_name') |
117
|
|
|
->setStoreReference('test_store_reference'); |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.