Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Static analysis

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
phpcs:
name: Code style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
ini-values: memory_limit=-1, date.timezone='UTC'
tools: phpcs, phpstan

- name: Validate composer.json
run: composer validate

- name: Install dependencies
run: composer update

- name: Generate action files
run: vendor/bin/codecept build

- name: Check production code style
run: phpcs src/

- name: Check test code style
run: phpcs tests/ --standard=tests/phpcs.xml

- name: Static analysis of production code
run: phpstan analyze src/ --level=1

- name: Static analysis of test code
run: phpstan analyze tests/
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
"autoload":{
"classmap": ["src/"]
},
"autoload-dev": {
"classmap": [
"tests/data/app/data.php",
"tests/unit/Codeception/Constraints/TestedWebElement.php"
],
"psr-4": {
"Tests\\Web\\": "tests/web/"
}
},
"config": {
"classmap-authoritative": true
}
Expand Down
7 changes: 7 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="Codeception">
<description>Codeception code standard</description>
<rule ref="PSR12">
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion src/Codeception/Constraint/WebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
}

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

if (count($nodes) < 5) {
$output .= "\nElements: ";
Expand Down
2 changes: 1 addition & 1 deletion src/Codeception/Constraint/WebDriverNot.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
}

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

Expand Down
Loading