Skip to content

Commit 19ee1ed

Browse files
committed
feat: add MySQL CI workflow and corresponding test classes for improved database testing.
1 parent ae1c5bc commit 19ee1ed

24 files changed

+196
-11
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ jobs:
2626
composer-command: |
2727
composer require yiisoft/yii2:22.0.x-dev --prefer-dist --no-progress --no-interaction --no-scripts --ansi
2828
concurrency-group: phpunit-${{ github.workflow }}-${{ github.ref }}
29+
exclude-group-phpunit: mysql
2930
extensions: pdo, pdo_sqlite
3031
phpunit-compatibility:
3132
uses: php-forge/actions/.github/workflows/phpunit.yml@main
3233
secrets:
3334
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3435
with:
3536
concurrency-group: compatibility-${{ github.workflow }}-${{ github.ref }}
37+
exclude-group-phpunit: mysql
3638
extensions: pdo, pdo_sqlite

.github/workflows/ci-mysql.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
- pull_request
3+
- push
4+
5+
name: ci-mysql
6+
7+
jobs:
8+
mysql:
9+
name: MySQL database tests.
10+
uses: ./.github/workflows/phpunit-database.yml
11+
secrets:
12+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13+
with:
14+
concurrency-group: mysql-${{ github.ref }}
15+
database-env: |
16+
{
17+
"MYSQL_DATABASE": "yiitest",
18+
"MYSQL_ROOT_PASSWORD": "root",
19+
}
20+
database-health-cmd: "mysqladmin ping"
21+
database-health-retries: 3
22+
database-image: mysql
23+
database-port: 3306
24+
database-type: mysql
25+
database-versions: '["8.0", "8.4", "latest"]'
26+
enable-concurrency: true
27+
group-phpunit: mysql
28+
extensions: pdo, pdo_mysql
29+
os: '["ubuntu-latest"]'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractCacheManagement;
9+
10+
#[Group('mysql')]
11+
final class CacheManagementTest extends AbstractCacheManagement
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractExceptionHandling;
9+
10+
#[Group('mysql')]
11+
final class ExceptionHandlingTest extends AbstractExceptionHandling
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

tests/mysql/ExtensibilityTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractExtensibility;
9+
10+
#[Group('mysql')]
11+
final class ExtensibilityTest extends AbstractExtensibility
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

tests/mysql/NodeAppendTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractNodeAppend;
9+
10+
#[Group('mysql')]
11+
final class NodeAppendTest extends AbstractNodeAppend
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

tests/mysql/NodeDeleteTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractNodeDelete;
9+
10+
#[Group('mysql')]
11+
final class NodeDeleteTest extends AbstractNodeDelete
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

tests/mysql/NodeInsertTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractNodeInsert;
9+
10+
#[Group('mysql')]
11+
final class NodeInsertTest extends AbstractNodeInsert
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

tests/mysql/NodePrependTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractNodePrepend;
9+
10+
#[Group('mysql')]
11+
final class NodePrependTest extends AbstractNodePrepend
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

tests/mysql/NodeStateTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace yii2\extensions\nestedsets\tests\mysql;
6+
7+
use PHPUnit\Framework\Attributes\Group;
8+
use yii2\extensions\nestedsets\tests\base\AbstractNodeState;
9+
10+
#[Group('mysql')]
11+
final class NodeStateTest extends AbstractNodeState
12+
{
13+
protected string|null $dsn = 'sqlite::memory:';
14+
}

0 commit comments

Comments
 (0)