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
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
checks:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3']
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: gen_queue_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -proot"
--health-interval=5s
--health-timeout=5s
--health-retries=20
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysqli
coverage: none
tools: composer:v2
- name: Install
run: composer update --no-interaction --no-progress --prefer-dist
- name: Lint
run: find src tests examples gen-queue.php autoload.php uninstall.php -name '*.php' -print0 | xargs -0 -n1 php -l
- name: PHP_CodeSniffer
run: composer lint
- name: PHPStan
run: composer analyse
- name: Unit tests
run: vendor/bin/phpunit --testsuite unit
- name: Integration tests (MySQL 8.0)
env:
GEN_QUEUE_TEST_DB_HOST: 127.0.0.1
GEN_QUEUE_TEST_DB_USER: root
GEN_QUEUE_TEST_DB_PASSWORD: root
GEN_QUEUE_TEST_DB_NAME: gen_queue_test
run: vendor/bin/phpunit --testsuite integration
6 changes: 3 additions & 3 deletions tests/Unit/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function testRegisteringInsideTheActionWorks(): void
{
$plugin = Plugin::boot(new MemoryStore());
add_action('gen_queue_register_types', static function (): void {
gen_queue_register_type('demo.inside', static fn (): null => null);
gen_queue_register_type('demo.inside', static fn (): ?array => null);
});
$plugin->openRegistration();
$this->assertTrue($plugin->registry->has('demo.inside'));
Expand All @@ -28,15 +28,15 @@ public function testRegisteringBeforeTheActionThrows(): void
{
$plugin = Plugin::boot(new MemoryStore());
$this->expectException(RegistrationException::class);
$plugin->registry->register('demo.early', static fn (): null => null);
$plugin->registry->register('demo.early', static fn (): ?array => null);
}

/** Test 1, case 1. */
public function testRegisteringAfterTheActionLogsANotice(): void
{
$plugin = Plugin::boot(new MemoryStore());
$plugin->openRegistration();
$plugin->registry->register('demo.late', static fn (): null => null);
$plugin->registry->register('demo.late', static fn (): ?array => null);
$this->assertTrue($plugin->registry->has('demo.late'));
$this->assertSame(1, $this->logged('"demo.late" was registered after'));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/RunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function testSuccessStoresResultClosesAttemptClearsCounterAndFires(): voi
public function testArrayAndNullReturnsAreSuccess(): void
{
$this->type('demo.array', static fn (): array => ['a' => 1]);
$this->type('demo.null', static fn (): null => null);
$this->type('demo.null', static fn (): ?array => null);
$a = gen_queue_enqueue('demo.array', []);
$b = gen_queue_enqueue('demo.null', []);
$this->drain();
Expand Down
Loading