Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .github/workflows/build-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
{
"ACCEPT_EULA": "Y",
"SA_PASSWORD": "YourStrong!Passw0rd",
"MSSQL_PID": "Developer"
"MSSQL_PID": "Developer",
}
database-health-cmd: "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'"
database-health-retries: 5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
database-env: |
{
"ORACLE_DATABASE": "yiitest",
"ORACLE_PASSWORD": "root"
"ORACLE_PASSWORD": "root",
}
database-health-cmd: "healthcheck.sh"
database-health-retries: 10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
{
"POSTGRES_DB": "yiitest",
"POSTGRES_USER": "root",
"POSTGRES_PASSWORD": "root"
"POSTGRES_PASSWORD": "root",
}
database-health-cmd: "pg_isready -U postgres"
database-health-retries: 3
Expand Down
17 changes: 6 additions & 11 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
class TestCase extends \PHPUnit\Framework\TestCase
{
use SchemaBuilderTrait;
protected string $driverName = 'sqlite';

protected string|null $dsn = null;
/**
* @phpstan-var string[]
*/
protected array $connection = [];
protected string $fixtureDirectory = __DIR__ . '/support/data/';
protected string $password = '';
protected string $username = '';

protected function setUp(): void
{
Expand Down Expand Up @@ -341,12 +341,7 @@ protected function mockConsoleApplication(): void
'id' => 'testapp',
'basePath' => dirname(__DIR__),
'components' => [
'db' => [
'class' => Connection::class,
'dsn' => $this->dsn !== null ? $this->dsn : 'sqlite::memory:',
'password' => $this->password,
'username' => $this->username,
],
'db' => $this->connection,
],
],
);
Expand All @@ -361,7 +356,7 @@ protected function mockConsoleApplication(): void
*/
protected function replaceQuotes(string $sql): string
{
return match ($this->driverName) {
return match ($this->getDb()->driverName) {
'mysql', 'sqlite' => str_replace(
['[[', ']]'],
'`',
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/CacheManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractCacheManagement;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for cache invalidation in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -34,10 +34,7 @@ final class CacheManagementTest extends AbstractCacheManagement
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/ExceptionHandlingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractExceptionHandling;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for exception handling in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -34,10 +34,7 @@ final class ExceptionHandlingTest extends AbstractExceptionHandling
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/ExtensibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractExtensibility;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for extensibility in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -34,10 +34,7 @@ final class ExtensibilityTest extends AbstractExtensibility
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/NodeAppendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractNodeAppend;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for node append and root promotion in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -37,10 +37,7 @@ final class NodeAppendTest extends AbstractNodeAppend
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/NodeDeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractNodeDelete;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for node deletion in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -38,10 +38,7 @@ final class NodeDeleteTest extends AbstractNodeDelete
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/NodeInsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractNodeInsert;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for node insertion in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -36,10 +36,7 @@ final class NodeInsertTest extends AbstractNodeInsert
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/NodePrependTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractNodePrepend;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for node prepend operations in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -35,10 +35,7 @@ final class NodePrependTest extends AbstractNodePrepend
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/NodeStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractNodeState;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for node state and relationship in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -34,10 +34,7 @@ final class NodeStateTest extends AbstractNodeState
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/QueryBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractQueryBehavior;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for query behavior in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -36,10 +36,7 @@ final class QueryBehaviorTest extends AbstractQueryBehavior
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/TreeTraversalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractTreeTraversal;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for tree traversal and relationship methods in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -34,10 +34,7 @@ final class TreeTraversalTest extends AbstractTreeTraversal
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
7 changes: 2 additions & 5 deletions tests/mssql/ValidationAndStructureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractValidationAndStructure;
use yii2\extensions\nestedsets\tests\support\MSSQLConnection;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

/**
* Test suite for validation and structural integrity in nested sets tree behaviors using SQL Server.
Expand Down Expand Up @@ -35,10 +35,7 @@ final class ValidationAndStructureTest extends AbstractValidationAndStructure
{
protected function setUp(): void
{
$this->driverName = MSSQLConnection::DRIVER_NAME->value;
$this->dsn = MSSQLConnection::DSN->value;
$this->password = MSSQLConnection::PASSWORD->value;
$this->username = MSSQLConnection::USERNAME->value;
$this->connection = DatabaseConnection::MSSQL->connection();

parent::setUp();
}
Expand Down
11 changes: 7 additions & 4 deletions tests/mysql/CacheManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractCacheManagement;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

#[Group('mysql')]
final class CacheManagementTest extends AbstractCacheManagement
{
protected string $driverName = 'mysql';
protected string|null $dsn = 'mysql:host=127.0.0.1;dbname=yiitest;charset=utf8mb4';
protected string $password = 'root';
protected string $username = 'root';
protected function setUp(): void
{
$this->connection = DatabaseConnection::MYSQL->connection();

parent::setUp();
}
}
11 changes: 7 additions & 4 deletions tests/mysql/ExceptionHandlingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractExceptionHandling;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

#[Group('mysql')]
final class ExceptionHandlingTest extends AbstractExceptionHandling
{
protected string $driverName = 'mysql';
protected string|null $dsn = 'mysql:host=127.0.0.1;dbname=yiitest;charset=utf8mb4';
protected string $password = 'root';
protected string $username = 'root';
protected function setUp(): void
{
$this->connection = DatabaseConnection::MYSQL->connection();

parent::setUp();
}
}
11 changes: 7 additions & 4 deletions tests/mysql/ExtensibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\base\AbstractExtensibility;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;

#[Group('mysql')]
final class ExtensibilityTest extends AbstractExtensibility
{
protected string $driverName = 'mysql';
protected string|null $dsn = 'mysql:host=127.0.0.1;dbname=yiitest;charset=utf8mb4';
protected string $password = 'root';
protected string $username = 'root';
protected function setUp(): void
{
$this->connection = DatabaseConnection::MYSQL->connection();

parent::setUp();
}
}
11 changes: 7 additions & 4 deletions tests/mysql/MutationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
namespace yii2\extensions\nestedsets\tests\mysql;

use PHPUnit\Framework\Attributes\Group;
use yii2\extensions\nestedsets\tests\support\DatabaseConnection;
use yii2\extensions\nestedsets\tests\support\model\MultipleTree;
use yii2\extensions\nestedsets\tests\TestCase;

#[Group('mutation')]
final class MutationTest extends TestCase
{
protected string $driverName = 'mysql';
protected string|null $dsn = 'mysql:host=127.0.0.1;dbname=yiitest;charset=utf8mb4';
protected string $password = 'root';
protected string $username = 'root';
protected function setUp(): void
{
$this->connection = DatabaseConnection::MYSQL->connection();

parent::setUp();
}

public function testLeavesMethodRequiresLeftAttributeOrderingForConsistentResults(): void
{
Expand Down
Loading
Loading