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
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI
on:
pull_request:
jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
php: [8.2, 8.3, 8.4]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: phpstan

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
- name: Run PHPStan
run: phpstan
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Automated release
on:
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
php: [ 8.2, 8.3, 8.4 ]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest

- name: Execute Code Sniffer
run: vendor/bin/phpcs

- name: Execute PHP Stan
run: vendor/bin/phpstan

- name: Run test suite
run: |
php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &
php -S 127.0.0.1:8010 -t tests/data/rest >/dev/null 2>&1 &
php vendor/bin/codecept run


release:
name: Automated release
needs:
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 22
- run: >
npx
-p "@semantic-release/commit-analyzer"
-p "@semantic-release/release-notes-generator"
-p conventional-changelog-conventionalcommits
-p semantic-release
-- semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
packages: write
contents: write
pull-requests: write
32 changes: 16 additions & 16 deletions src/Codeception/Util/Shared/InheritedAsserts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PHPUnit\Framework\Constraint\LogicalNot;
use PHPUnit\Framework\Constraint\StringMatchesFormatDescription;
use ReflectionClass;
use ReflectionException;

trait InheritedAsserts
{
Expand Down Expand Up @@ -49,7 +50,7 @@ protected function assertClassHasStaticAttribute(string $attributeName, string $
{
trigger_error(__FUNCTION__ . ' was removed from PHPUnit since PHPUnit 10', E_USER_DEPRECATED);

Assert::assertTrue($this->hasStaticAttribute($attributeName, $className), $message);
Assert::assertTrue(self::hasStaticAttribute($attributeName, $className), $message);
}

/**
Expand All @@ -69,7 +70,7 @@ protected function assertClassNotHasAttribute(string $attributeName, string $cla
protected function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
{
trigger_error(__FUNCTION__ . ' was removed from PHPUnit since PHPUnit 10', E_USER_DEPRECATED);
Assert::assertFalse($this->hasStaticAttribute($attributeName, $className), $message);
Assert::assertFalse(self::hasStaticAttribute($attributeName, $className), $message);
}

/**
Expand Down Expand Up @@ -401,8 +402,7 @@ protected function assertInstanceOf(string $expected, $actual, string $message =
* Asserts that a variable is of type array.
*
* @param mixed $actual
*
* @phpstan-assert array $actual
* @phpstan-assert array<mixed> $actual
*/
protected function assertIsArray($actual, string $message = ''): void
{
Expand Down Expand Up @@ -474,7 +474,7 @@ protected function assertIsInt($actual, string $message = ''): void
*
* @param mixed $actual
*
* @phpstan-assert iterable $actual
* @phpstan-assert iterable<mixed> $actual
*/
protected function assertIsIterable($actual, string $message = ''): void
{
Expand All @@ -486,7 +486,7 @@ protected function assertIsIterable($actual, string $message = ''): void
*
* @param mixed $actual
*
* @phpstan-assert !array $actual
* @phpstan-assert !array<mixed> $actual
*/
protected function assertIsNotArray($actual, string $message = ''): void
{
Expand Down Expand Up @@ -558,7 +558,7 @@ protected function assertIsNotInt($actual, string $message = ''): void
*
* @param mixed $actual
*
* @phpstan-assert !iterable $actual
* @phpstan-assert !iterable<mixed> $actual
*/
protected function assertIsNotIterable($actual, string $message = ''): void
{
Expand Down Expand Up @@ -1143,7 +1143,7 @@ protected function assertStringNotEqualsFileIgnoringCase(string $expectedFile, s
/**
* Asserts that a string does not match a given format string.
*/
protected function assertStringNotMatchesFormat(string $format, string $string, string $message = '')
protected function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void
{
trigger_error(__FUNCTION__ . ' was removed from PHPUnit since PHPUnit 12', E_USER_DEPRECATED);
$constraint = new LogicalNot(new StringMatchesFormatDescription($format));
Expand All @@ -1153,15 +1153,14 @@ protected function assertStringNotMatchesFormat(string $format, string $string,
/**
* Asserts that a string does not match a given format string.
*/
protected function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = '')
protected function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void
{
trigger_error(__FUNCTION__ . ' was removed from PHPUnit since PHPUnit 12', E_USER_DEPRECATED);
Assert::assertFileExists($formatFile);
$constraint = new LogicalNot(
new StringMatchesFormatDescription(
file_get_contents($formatFile)
)
);
$content = file_get_contents($formatFile);
if ($content === false) {
Assert::fail(sprintf('Failed to read format file "%s"', $formatFile));
}
$constraint = new LogicalNot(new StringMatchesFormatDescription($content));
Assert::assertThat($string, $constraint, $message);
}

Expand Down Expand Up @@ -1320,8 +1319,9 @@ protected function markTestSkipped(string $message = ''): never

/**
* @see https://github.com/sebastianbergmann/phpunit/blob/9.6/src/Framework/Constraint/Object/ClassHasStaticAttribute.php
* @param class-string $className
*/
private static function hasStaticAttribute(string $attributeName, string $className)
private static function hasStaticAttribute(string $attributeName, string $className): bool
{
try {
$class = new \ReflectionClass($className);
Expand Down