@@ -11,8 +11,8 @@ |
||
11 | 11 | // Helpers. |
12 | 12 | use Behat\Mink\Element\NodeElement; |
13 | 13 | // Utils. |
14 | -use Drupal\TqExtension\Utils\XPath; |
|
15 | 14 | use Drupal\TqExtension\Cores\DrupalKernelPlaceholder; |
15 | +use Drupal\TqExtension\Utils\XPath; |
|
16 | 16 | |
17 | 17 | class RawPageContext extends RawDrupalContext |
18 | 18 | { |
@@ -211,7 +211,7 @@ |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | $selector = DrupalKernelPlaceholder::t($selector); |
214 | - $element = $this->{'find' . $map[$locator]}($selector); |
|
214 | + $element = $this->{'find'.$map[$locator]}($selector); |
|
215 | 215 | $this->throwNoSuchElementException($selector, $element); |
216 | 216 | |
217 | 217 | return $element; |
@@ -7,9 +7,9 @@ |
||
7 | 7 | // Scope definitions. |
8 | 8 | use Behat\Behat\Hook\Scope; |
9 | 9 | // Utils. |
10 | +use Drupal\TqExtension\Cores\DrupalKernelPlaceholder; |
|
10 | 11 | use Drupal\TqExtension\Utils\Database\Database; |
11 | 12 | use Drupal\TqExtension\Utils\LogicalAssertion; |
12 | -use Drupal\TqExtension\Cores\DrupalKernelPlaceholder; |
|
13 | 13 | |
14 | 14 | class TqContext extends RawTqContext |
15 | 15 | { |
@@ -221,8 +221,7 @@ |
||
221 | 221 | strpos($error->message, $message) === 0 && ('' === $file ?: strpos($error->location, $file) === 0), |
222 | 222 | $negate |
223 | 223 | )) { |
224 | - case 1: |
|
225 | - throw new \Exception(sprintf('The "%s" error found, but should not be.', $message)); |
|
224 | + case 1 : throw new \Exception(sprintf('The "%s" error found, but should not be.', $message)); |
|
226 | 225 | |
227 | 226 | case 2: |
228 | 227 | throw new \Exception(sprintf('The "%s" error not found, but should be.', $message)); |
@@ -165,7 +165,7 @@ |
||
165 | 165 | static $original = 'php_mail'; |
166 | 166 | |
167 | 167 | $systemMail = \Drupal::configFactory() |
168 | - ->getEditable('system.mail'); |
|
168 | + ->getEditable('system.mail'); |
|
169 | 169 | |
170 | 170 | if ($useTesting) { |
171 | 171 | // Store original mail system to restore it after scenario. |
@@ -5,14 +5,14 @@ |
||
5 | 5 | namespace Drupal\TqExtension\Cores; |
6 | 6 | |
7 | 7 | use Behat\Behat\Hook\Scope\BeforeFeatureScope; |
8 | -use Drupal\Core\Field\FieldDefinitionInterface; |
|
9 | -use Drupal\Core\Entity\FieldableEntityInterface; |
|
10 | -use Drupal\Core\Session\AccountInterface; |
|
8 | +use Drupal\Component\Render\FormattableMarkup; |
|
9 | +use Drupal\Component\Serialization\Json; |
|
11 | 10 | use Drupal\Core\Database\Database; |
12 | 11 | use Drupal\Core\Database\Query\Select; |
12 | +use Drupal\Core\Entity\FieldableEntityInterface; |
|
13 | +use Drupal\Core\Field\FieldDefinitionInterface; |
|
14 | +use Drupal\Core\Session\AccountInterface; |
|
13 | 15 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
14 | -use Drupal\Component\Render\FormattableMarkup; |
|
15 | -use Drupal\Component\Serialization\Json; |
|
16 | 16 | use Drupal\TqExtension\Utils\Database\FetchField; |
17 | 17 | |
18 | 18 | final class Drupal8Placeholder extends DrupalKernelPlaceholder |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | // Start with base URL when path is empty, or not starts from "//" or "http". |
38 | 38 | if (empty($path) || strpos($path, '//') !== 0 && strpos($path, 'http') !== 0) { |
39 | - $path = rtrim($baseUrl, '/') . '/' . trim($path, '/'); |
|
39 | + $path = rtrim($baseUrl, '/').'/'.trim($path, '/'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->setUrl($path)->scheme()->credentials()->host()->components(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | throw new \InvalidArgumentException(sprintf('%s - invalid scheme.', $this->components['scheme'])); |
88 | 88 | } |
89 | 89 | |
90 | - $this->url = $this->components['scheme'] . '://'; |
|
90 | + $this->url = $this->components['scheme'].'://'; |
|
91 | 91 | |
92 | 92 | return $this; |
93 | 93 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // Encode special characters in username and password. Useful |
104 | 104 | // when some item contain something like "@" symbol. |
105 | 105 | foreach (['user' => ':', 'pass' => '@'] as $part => $suffix) { |
106 | - $this->url .= rawurlencode($this->components[$part]) . $suffix; |
|
106 | + $this->url .= rawurlencode($this->components[$part]).$suffix; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | foreach (['port' => ':', 'path' => '', 'query' => '?', 'fragment' => '#'] as $part => $prefix) { |
133 | 133 | if (isset($this->components[$part])) { |
134 | - $this->url .= $prefix . $this->components[$part]; |
|
134 | + $this->url .= $prefix.$this->components[$part]; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 |
@@ -117,6 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | /** |
119 | 119 | * {@inheritdoc} |
120 | + * @param string $name |
|
120 | 121 | */ |
121 | 122 | public function getDrupalText($name) |
122 | 123 | { |
@@ -216,7 +217,7 @@ discard block |
||
216 | 217 | * @param array $args |
217 | 218 | * Placeholder declarations. |
218 | 219 | * |
219 | - * @return mixed |
|
220 | + * @return string |
|
220 | 221 | */ |
221 | 222 | public function executeJs($javascript, array $args = []) |
222 | 223 | { |
@@ -233,7 +234,7 @@ discard block |
||
233 | 234 | * |
234 | 235 | * @param StepScope $event |
235 | 236 | * |
236 | - * @return int |
|
237 | + * @return boolean |
|
237 | 238 | */ |
238 | 239 | public static function isStepImpliesJsEvent(StepScope $event) |
239 | 240 | { |
@@ -11,22 +11,22 @@ |
||
11 | 11 | use Behat\Behat\Context\Exception\ContextNotFoundException; |
12 | 12 | use Behat\DebugExtension\Debugger; |
13 | 13 | // Helpers. |
14 | -use WebDriver\Session; |
|
15 | -use Drupal\Driver\DrushDriver; |
|
16 | -use Drupal\Driver\DriverInterface as DrupalDriverInterface; |
|
17 | -use Drupal\Component\Utility\Random; |
|
18 | -use Behat\Mink\Element\NodeElement; |
|
14 | +use Behat\Behat\Context\Environment\InitializedContextEnvironment; |
|
15 | +use Behat\Behat\Hook\Scope\StepScope; |
|
16 | +use Behat\Mink\Driver\DriverInterface as SessionDriverInterface; |
|
19 | 17 | use Behat\Mink\Driver\GoutteDriver; |
20 | 18 | use Behat\Mink\Driver\Selenium2Driver; |
21 | -use Behat\Mink\Driver\DriverInterface as SessionDriverInterface; |
|
22 | -use Behat\Behat\Hook\Scope\StepScope; |
|
23 | -use Behat\Behat\Context\Environment\InitializedContextEnvironment; |
|
19 | +use Behat\Mink\Element\NodeElement; |
|
24 | 20 | use Behat\Testwork\Environment\Environment; |
21 | +use Drupal\Component\Utility\Random; |
|
22 | +use Drupal\Driver\DriverInterface as DrupalDriverInterface; |
|
23 | +use Drupal\Driver\DrushDriver; |
|
24 | +use WebDriver\Session; |
|
25 | 25 | // Utils. |
26 | -use Drupal\TqExtension\Utils\Url; |
|
27 | -use Drupal\TqExtension\Utils\Tags; |
|
28 | -use Drupal\TqExtension\Utils\JavaScript; |
|
29 | 26 | use Drupal\TqExtension\Cores\DrupalKernelPlaceholder; |
27 | +use Drupal\TqExtension\Utils\JavaScript; |
|
28 | +use Drupal\TqExtension\Utils\Tags; |
|
29 | +use Drupal\TqExtension\Utils\Url; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @see RawTqContext::__call() |
@@ -91,6 +91,9 @@ |
||
91 | 91 | self::requireContext(__FUNCTION__, func_get_args()); |
92 | 92 | } |
93 | 93 | |
94 | + /** |
|
95 | + * @param string $path |
|
96 | + */ |
|
94 | 97 | public static function setCurrentPath($path) |
95 | 98 | { |
96 | 99 | self::requireContext(__FUNCTION__, func_get_args()); |
@@ -300,9 +300,9 @@ |
||
300 | 300 | $replace = ''; |
301 | 301 | } else { |
302 | 302 | // Copy the file. |
303 | - copy(str_replace('Cores', 'JavaScript', __DIR__) . '/' . $file, $destination); |
|
303 | + copy(str_replace('Cores', 'JavaScript', __DIR__).'/'.$file, $destination); |
|
304 | 304 | // Find an unique line and append injection. |
305 | - $replace = $search . $injection; |
|
305 | + $replace = $search.$injection; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | file_put_contents($target, str_replace($search, $replace, file_get_contents($target))); |
@@ -155,7 +155,7 @@ |
||
155 | 155 | $entity = entity_create($entityType, $values); |
156 | 156 | |
157 | 157 | entity_save($entityType, $entity); |
158 | - list($entityId, , $bundle) = entity_extract_ids($entityType, $entity); |
|
158 | + list($entityId,, $bundle) = entity_extract_ids($entityType, $entity); |
|
159 | 159 | |
160 | 160 | return [$entityId, $entityType, $bundle]; |
161 | 161 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | static $files = []; |
24 | 24 | |
25 | 25 | if (empty($files[$filename])) { |
26 | - $path = str_replace('Utils', 'JavaScript', __DIR__) . "/$filename.js"; |
|
26 | + $path = str_replace('Utils', 'JavaScript', __DIR__)."/$filename.js"; |
|
27 | 27 | |
28 | 28 | if (!file_exists($path)) { |
29 | 29 | throw new \RuntimeException(sprintf('File "%s" does not exists!', $path)); |
@@ -73,6 +73,6 @@ |
||
73 | 73 | throw new \RuntimeException('An ID cannot be zero.'); |
74 | 74 | } |
75 | 75 | |
76 | - return $this->entityType() . "/$id$operation"; |
|
76 | + return $this->entityType()."/$id$operation"; |
|
77 | 77 | } |
78 | 78 | } |