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
35 changes: 31 additions & 4 deletions tests/mssql/CacheManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,39 @@

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

/**
* Test suite for cache invalidation in nested sets tree behaviors using SQL Server.
*
* Verifies correct cache management, invalidation, and memoization for nested sets tree structures in SQL Server
* environments, covering node insertions, updates, deletions, and structural changes for both single and multiple tree
* models.
*
* Inherits integration and unit tests from {@see AbstractCacheManagement} to ensure cache lifecycle correctness,
* including depth, left, and right attribute handling, and supports both manual and automatic cache invalidation
* scenarios.
*
* Key features.
* - Ensures compatibility and correctness of cache logic on the SQL Server platform.
* - Full coverage of cache population, invalidation, and memoization for nested sets behaviors.
* - SQL Server-specific configuration for database connection and credentials.
*
* @see AbstractCacheManagement for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class CacheManagementTest extends AbstractCacheManagement
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
35 changes: 31 additions & 4 deletions tests/mssql/ExceptionHandlingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,39 @@

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

/**
* Test suite for exception handling in nested sets tree behaviors using SQL Server.
*
* Verifies correct exception throwing and error messages for invalid node operations and edge cases in nested sets tree
* structures on SQL Server, covering both single and multiple tree models.
*
* Inherits unit tests from {@see AbstractExceptionHandling} to ensure robustness of the nested sets behavior by
* simulating invalid operations such as appending, inserting, deleting, and making root nodes under unsupported
* conditions.
*
* Key features.
* - Ensures error handling consistency for unsupported operations on SQL Server.
* - Full coverage for invalid append, insert, delete, and makeRoot operations.
* - Support for both single-tree and multi-tree models.
* - Tests for exception messages and types in various edge cases.
*
* @see AbstractExceptionHandling for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class ExceptionHandlingTest extends AbstractExceptionHandling
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
35 changes: 31 additions & 4 deletions tests/mssql/ExtensibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,39 @@

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

/**
* Test suite for extensibility in nested sets tree behaviors using SQL Server.
*
* Verifies that protected methods in the nested sets behavior remain accessible and customizable for subclassing
* scenarios on SQL Server, ensuring extensibility for advanced use cases in both single-tree and multi-tree models.
*
* Inherits unit tests from {@see AbstractExtensibility} to validate the exposure and correct execution of key internal
* methods, supporting framework extension and advanced customization in descendant classes.
*
* Key features.
* - Ensures protected methods are accessible for subclass extension.
* - Supports both single-tree and multi-tree model scenarios.
* - Tests before-insert and move operations for extensibility.
* - Validates extensibility for root and non-root node operations.
* - Verifies correct attribute assignment by protected methods.
*
* @see AbstractExtensibility for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class ExtensibilityTest extends AbstractExtensibility
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
38 changes: 34 additions & 4 deletions tests/mssql/NodeAppendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,42 @@

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

/**
* Test suite for node append and root promotion in nested sets tree behaviors using SQL Server.
*
* Provides comprehensive unit and integration tests for appending nodes and promoting nodes to root in nested sets tree
* structures on SQL Server, ensuring correct tree structure, attribute updates, and validation logic for both
* single-tree and multi-tree models.
*
* Inherits tests from {@see AbstractNodeAppend} to validate node append operations, strict validation scenarios, root
* promotion, and XML dataset matching after structural changes, covering edge cases such as validation bypass,
* attribute refresh requirements, and cross-tree operations.
*
* Key features.
* - Covers both {@see Tree} and {@see MultipleTree} model scenarios.
* - Cross-tree append operations for multi-tree models.
* - Ensures correct left, right, depth, and tree attribute updates for SQL Server.
* - Root promotion and attribute refresh verification.
* - Validation of strict and non-strict append operations.
* - XML dataset matching after structural changes.
*
* @see AbstractNodeAppend for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class NodeAppendTest extends AbstractNodeAppend
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
39 changes: 35 additions & 4 deletions tests/mssql/NodeDeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,43 @@

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

/**
* Test suite for node deletion in nested sets tree behaviors using SQL Server.
*
* Provides comprehensive unit tests for node and subtree deletion operations in nested sets tree structures on SQL
* Server, ensuring correct state transitions, affected row counts, and data integrity after deletions for both
* single-tree and multi-tree models.
*
* Inherits tests from {@see AbstractNodeDelete} to validate node deletion, subtree removals, abort scenarios,
* transactional behavior, and update operations on node attributes, covering edge cases and XML dataset consistency
* after deletions.
*
* Key features.
* - Covers update operations and affected row count for node attribute changes.
* - Ensures correct affected row counts for node and subtree deletions in both {@see Tree} and {@see MultipleTree}
* models.
* - SQL Server-specific configuration for database connection and credentials.
* - Tests aborting deletions via `beforeDelete()` and transactional behavior.
* - Validates XML dataset consistency after deletions.
* - Verifies node state transitions after `deleteWithChildren()` (new record status, old attributes).
*
* @see AbstractNodeDelete for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class NodeDeleteTest extends AbstractNodeDelete
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
37 changes: 33 additions & 4 deletions tests/mssql/NodeInsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,41 @@

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

/**
* Test suite for node insertion in nested sets tree behaviors using SQL Server.
*
* Provides comprehensive unit tests for node insertion operations in nested sets tree structures on SQL Server,
* ensuring correct behavior for inserting nodes before and after targets, with and without validation, and across both
* single-tree and multi-tree models.
*
* Inherits tests from {@see AbstractNodeInsert} to validate insertion logic, strict validation scenarios, cross-tree
* insertions, and XML dataset matching after structural changes, covering edge cases such as validation bypass,
* attribute refresh requirements, and multi-tree operations.
*
* Key features.
* - Covers both {@see Tree} and {@see MultipleTree} model scenarios.
* - Edge case handling for strict validation and cross-tree insertions.
* - Ensures correct left, right, depth, and tree attribute updates for SQL Server.
* - Validation of strict and non-strict insert operations.
* - XML dataset matching after structural changes.
*
* @see AbstractNodeInsert for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class NodeInsertTest extends AbstractNodeInsert
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
36 changes: 32 additions & 4 deletions tests/mssql/NodePrependTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,40 @@

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

/**
* Test suite for node prepend operations in nested sets tree behaviors using SQL Server.
*
* Provides comprehensive unit and integration tests for prepending nodes in nested sets tree structures on SQL Server,
* ensuring correct tree structure, attribute updates, and validation logic for both single-tree and multi-tree models.
*
* Inherits tests from {@see AbstractNodePrepend} to validate node prepend operations, strict validation scenarios, and
* XML dataset matching after structural changes, covering edge cases such as validation bypass, attribute refresh
* requirements, and cross-tree operations.
*
* Key features.
* - Covers both {@see Tree} and {@see MultipleTree} model scenarios.
* - Ensures correct left, right, depth, and tree attribute updates after prepend operations for SQL Server.
* - Tests for prepending new and existing nodes, including cross-tree operations.
* - Validation of strict and non-strict prepend operations.
* - XML dataset matching after structural changes.
*
* @see AbstractNodePrepend for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class NodePrependTest extends AbstractNodePrepend
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
35 changes: 31 additions & 4 deletions tests/mssql/NodeStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,39 @@

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

/**
* Test suite for node state and relationship in nested sets tree behaviors using SQL Server.
*
* Provides comprehensive unit tests for verifying node state, parent-child relationships, and root/leaf detection in
* both single-tree and multi-tree nested sets models on SQL Server.
*
* Inherits tests from {@see AbstractNodeState} to ensure correctness of methods that determine node ancestry, root
* status, and leaf status by testing various edge cases and boundary conditions, such as equal left/right values and
* ancestor chains.
*
* Key features.
* - Coverage for both {@see Tree} and {@see MultipleTree} model implementations.
* - Ensures correct behavior for left/right value manipulations and ancestor checks.
* - Tests for `isChildOf()` under different ancestor and boundary scenarios.
* - Validation of `isRoot()` and `isLeaf()` logic for root, leaf, and intermediate nodes.
*
* @see AbstractNodeState for test logic and scenarios.
*
* @copyright Copyright (C) 2023 Terabytesoftw.
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
*/
#[Group('mssql')]
final class NodeStateTest extends AbstractNodeState
{
protected string $driverName = 'sqlsrv';
protected string|null $dsn = 'sqlsrv:Server=127.0.0.1,1433;Database=yiitest;Encrypt=no';
protected string $password = 'YourStrong!Passw0rd';
protected string $username = 'SA';
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;

parent::setUp();
}
}
Loading