Skip to content

Commit 92141f1

Browse files
authored
Merge pull request #94 from Codeception/code-style
Code style
2 parents 4560d65 + a84cbb1 commit 92141f1

30 files changed

+458
-272
lines changed

.github/workflows/static-analysis.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Static analysis
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
phpcs:
11+
name: Code style
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Install PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.1'
21+
ini-values: memory_limit=-1, date.timezone='UTC'
22+
tools: phpcs, phpstan
23+
24+
- name: Validate composer.json
25+
run: composer validate
26+
27+
- name: Install dependencies
28+
run: composer update
29+
30+
- name: Generate action files
31+
run: vendor/bin/codecept build
32+
33+
- name: Check production code style
34+
run: phpcs src/
35+
36+
- name: Check test code style
37+
run: phpcs tests/ --standard=tests/phpcs.xml
38+
39+
- name: Static analysis of production code
40+
run: phpstan analyze src/ --level=1
41+
42+
- name: Static analysis of test code
43+
run: phpstan analyze tests/

composer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
"autoload":{
3434
"classmap": ["src/"]
3535
},
36+
"autoload-dev": {
37+
"classmap": [
38+
"tests/data/app/data.php",
39+
"tests/unit/Codeception/Constraints/TestedWebElement.php"
40+
],
41+
"psr-4": {
42+
"Tests\\Web\\": "tests/web/"
43+
}
44+
},
3645
"config": {
3746
"classmap-authoritative": true
3847
}

phpcs.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Codeception">
3+
<description>Codeception code standard</description>
4+
<rule ref="PSR12">
5+
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
6+
</rule>
7+
</ruleset>

src/Codeception/Constraint/WebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
5454
}
5555

5656
$output = "Failed asserting that any element by " . Locator::humanReadableString($selector);
57-
$output .= $this->uriMessage('on page');
57+
$output .= ' ' . $this->uriMessage('on page');
5858

5959
if (count($nodes) < 5) {
6060
$output .= "\nElements: ";

src/Codeception/Constraint/WebDriverNot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
3838
}
3939

4040
$output = "There was {$selector} element";
41-
$output .= $this->uriMessage("on page");
41+
$output .= ' ' . $this->uriMessage('on page');
4242
$output .= $this->nodesList($nodes, $this->string);
4343
$output .= "\ncontaining '{$this->string}'";
4444

0 commit comments

Comments
 (0)