Skip to content

Commit b404c06

Browse files
committed
Fixed coding standards.
1 parent a4624f2 commit b404c06

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"dealerdirect/phpcodesniffer-composer-installer": "^1",
2626
"dmore/behat-chrome-extension": "^1.4",
2727
"drevops/behat-phpserver": "^2.0",
28+
"drevops/phpcs-standard": "^0.2.0",
2829
"drupal/coder": "^8.3",
2930
"dvdoug/behat-code-coverage": "^5.3",
3031
"ergebnis/composer-normalize": "^2.44",

phpcs.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<rule ref="Generic.PHP.RequireStrictTypes">
1111
<exclude-pattern>BehatCliContext\.php</exclude-pattern>
1212
</rule>
13+
<rule ref="DrevOps.NamingConventions.LocalVariableSnakeCase">
14+
<exclude-pattern>BehatCliContext\.php</exclude-pattern>
15+
</rule>
16+
<rule ref="DrevOps.NamingConventions.ParameterSnakeCase">
17+
<exclude-pattern>BehatCliContext\.php</exclude-pattern>
18+
</rule>
1319

1420
<!-- Show sniff codes in all reports -->
1521
<arg value="s"/>

tests/behat/bootstrap/BehatCliTrait.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function behatCliWriteFeatureContextFile(array $traits = []): string {
7676
'{{USE_IN_CLASS}}' => '',
7777
];
7878
foreach ($traits as $path => $trait) {
79-
$traitName = $trait;
79+
$trait_name = $trait;
8080
if (strpos($trait, '\\') !== FALSE) {
8181
$tokens['{{USE_DECLARATION}}'] .= sprintf('use %s;' . PHP_EOL, $trait);
82-
$traitNameParts = explode('\\', $trait);
83-
$traitName = end($traitNameParts);
82+
$trait_name_parts = explode('\\', $trait);
83+
$trait_name = end($trait_name_parts);
8484
}
85-
$tokens['{{USE_IN_CLASS}}'] .= sprintf('use %s;' . PHP_EOL, $traitName);
85+
$tokens['{{USE_IN_CLASS}}'] .= sprintf('use %s;' . PHP_EOL, $trait_name);
8686

8787
if (is_string($path) && file_exists($path)) {
8888
$filename = $this->workingDir . DIRECTORY_SEPARATOR . 'features/bootstrap/' . basename($path);
@@ -182,11 +182,11 @@ public function behatCliWriteScenarioSteps(PyStringNode $content, string $tags =
182182
$content = strtr((string) $content, ["'''" => '"""']);
183183

184184
// Make sure that indentation in provided content is accurate.
185-
$contentLines = explode(PHP_EOL, $content);
186-
foreach ($contentLines as $k => $contentLine) {
187-
$contentLines[$k] = str_repeat(' ', 4) . trim($contentLine);
185+
$content_lines = explode(PHP_EOL, $content);
186+
foreach ($content_lines as $k => $content_line) {
187+
$content_lines[$k] = str_repeat(' ', 4) . trim($content_line);
188188
}
189-
$content = implode(PHP_EOL, $contentLines);
189+
$content = implode(PHP_EOL, $content_lines);
190190

191191
$tokens = [
192192
'{{SCENARIO_CONTENT}}' => $content,
@@ -333,16 +333,16 @@ public function behatCliWriteScreenshotTestContext(PyStringNode $content): void
333333
}
334334

335335
// Update the behat.yml to include this context.
336-
$behatYmlPath = $this->workingDir . DIRECTORY_SEPARATOR . 'behat.yml';
337-
if (file_exists($behatYmlPath)) {
338-
$behatYml = file_get_contents($behatYmlPath);
339-
if (strpos($behatYml, 'FullscreenTestContext') === FALSE) {
340-
$behatYml = str_replace(
336+
$behat_yml_path = $this->workingDir . DIRECTORY_SEPARATOR . 'behat.yml';
337+
if (file_exists($behat_yml_path)) {
338+
$behat_yml = file_get_contents($behat_yml_path);
339+
if (strpos($behat_yml, 'FullscreenTestContext') === FALSE) {
340+
$behat_yml = str_replace(
341341
'ScreenshotContext',
342342
"ScreenshotContext\n - FullscreenTestContext",
343-
$behatYml
343+
$behat_yml
344344
);
345-
file_put_contents($behatYmlPath, $behatYml);
345+
file_put_contents($behat_yml_path, $behat_yml);
346346
}
347347
}
348348
}

0 commit comments

Comments
 (0)