1 | <?php |
||
32 | class MultilingualContext extends RawMultilingualContext { |
||
33 | |||
34 | /** Multilanguage implementation */ |
||
35 | |||
36 | // Declaring translations variable to store all translations. |
||
37 | public $translations = array(); |
||
38 | |||
39 | // Declaring languages_iso_codes variable to store all languages ISO codes from json file. |
||
40 | public $languages_iso_codes = array(); |
||
41 | |||
42 | |||
43 | // Parse the YAML translations to PHP array variable. |
||
44 | public function parseTranslationFile() { |
||
54 | |||
55 | // Checks whether the translations file variable is set in the Behat profile and parses it to array. |
||
56 | public function initializeMultilanguage() { |
||
62 | |||
63 | //This function parses the languages_iso_codes.json file to an array. |
||
64 | public function parseLanguageCodes() { |
||
68 | |||
69 | /* |
||
70 | * This function detects site's language based on URL. If no URL language is detected |
||
71 | * the default_language is used. |
||
72 | */ |
||
73 | |||
74 | public function languageDetection() { |
||
93 | |||
94 | /** |
||
95 | * This function localizes the targeted string. It tries to find a definition of the provided text (in English) |
||
96 | * in the translations file that is provided within the profile parameters. If it fails to find translation |
||
97 | * for the requested language it falls back to English. If the string is not defined at all in the translations |
||
98 | * file there will be an exception thrown. |
||
99 | */ |
||
100 | |||
101 | public function localizeTarget($target) { |
||
112 | |||
113 | /** |
||
114 | * This function localizes the field based on Drupal standards. default_language variable is used as a base. |
||
115 | */ |
||
116 | |||
117 | public function localizeField($field) { |
||
123 | |||
124 | |||
125 | /** |
||
126 | * Initialize the multilingual context before the scenario. |
||
127 | * @BeforeScenario |
||
128 | * @Given /^I initialize multilingual context/ |
||
129 | */ |
||
130 | public function iInitializeMultilingualContext() { |
||
133 | |||
134 | /** |
||
135 | * |
||
136 | * @Given /^I follow localized "(?P<link>(?:[^"]|\\")*)"/ |
||
137 | */ |
||
138 | public function iFollowLocalized($target) { |
||
150 | |||
151 | /** |
||
152 | * |
||
153 | * @Given /^I follow second localized "(?P<link>(?:[^"]|\\")*)"/ |
||
154 | */ |
||
155 | public function iFollowLocalizedSecond($target) { |
||
159 | |||
160 | /** |
||
161 | * Click on some text. |
||
162 | * |
||
163 | * @When /^I click on the localized text "([^"]*)"$/ |
||
164 | */ |
||
165 | |||
166 | public function iClickOnTheLocalizedText($target) { |
||
170 | |||
171 | /** |
||
172 | * Checks, that page contains specified text in input |
||
173 | * |
||
174 | * @Then /^(?:|I )should see localized value "(?P<text>(?:[^"]|\\")*)" in input "([^"]*)"$/ |
||
175 | */ |
||
176 | |||
177 | public function iShouldSeeLocalizedValueInInput($value, $input) { |
||
181 | |||
182 | /** |
||
183 | * Checks, that page contains specified text |
||
184 | * |
||
185 | * @Then /^(?:|I )should see localized "(?P<text>(?:[^"]|\\")*)"$/ |
||
186 | */ |
||
187 | |||
188 | public function iShouldSeeLocalized($target) { |
||
192 | |||
193 | /** |
||
194 | * Checks, that page doesn't contain specified text |
||
195 | * |
||
196 | * @Then /^(?:|I )should not see localized "(?P<text>(?:[^"]|\\")*)"$/ |
||
197 | */ |
||
198 | public function iShouldNotSeeLocalized($target) |
||
203 | |||
204 | /** |
||
205 | * Waiting for text to appear on a page with certain execution time |
||
206 | * |
||
207 | * @When /^I wait for localized text "([^"]*)" to appear with max time "([^"]+)"(?: seconds)?$/ |
||
208 | */ |
||
209 | public function iWaitForLocalizedTextToAppearWithMaxTime($target, $maxExecutionTime){ |
||
213 | |||
214 | /** |
||
215 | * Fills in form field with specified id|name|label|value |
||
216 | * Example: When I fill in "username" with: "bwayne" |
||
217 | * Example: And I fill in "bwayne" for "username" |
||
218 | * |
||
219 | * @When /^(?:|I )fill in localized "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/ |
||
220 | * @When /^(?:|I )fill in localized "(?P<field>(?:[^"]|\\")*)" with:$/ |
||
221 | * @When /^(?:|I )fill in localized "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/ |
||
222 | */ |
||
223 | public function fillLocalizedField($field, $value) |
||
228 | |||
229 | /** |
||
230 | * @Given I click localized :link in the :rowText row |
||
231 | * @Then I (should )see the localized :link in the :rowText row |
||
232 | */ |
||
233 | public function assertLocalizedClickInTableRow($link, $rowText){ |
||
243 | |||
244 | public function getTableRow(Element $element, $search) { |
||
256 | |||
257 | /** |
||
258 | * Click on text in specified region |
||
259 | * |
||
260 | * @When /^I click on the localized text "([^"]*)" in the "(?P<region>[^"]*)"(?:| region)$/ |
||
261 | */ |
||
262 | public function iClickOnTheLocalizedTextInRegion($text, $region){ |
||
266 | |||
267 | /** |
||
268 | * Choose certain option from given selector |
||
269 | * |
||
270 | * @When I select localized :option from chosen :selector |
||
271 | */ |
||
272 | public function lselectLocalizedOptionWithJavascript($selector, $option) { |
||
276 | |||
277 | /** |
||
278 | * @When I select the localized radio button :label with the id :id |
||
279 | * @When I select the localized radio button :label |
||
280 | * |
||
281 | */ |
||
282 | public function assertSelectLocalizedRadioById($label, $id = '') { |
||
286 | } |
||
287 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..