Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c3916ea
feat: Add mutation testing configuration and update `PHPUnit` schema …
terabytesoftw Jun 28, 2025
023fa50
test: Add test for shifting left and right attributes after deleting …
terabytesoftw Jun 28, 2025
1dbbb17
test: Rename test for shifting left and right attributes after deleti…
terabytesoftw Jun 28, 2025
d039c60
feat: Update mutation testing configuration and clean up JSON files.
terabytesoftw Jun 28, 2025
fd62276
feat: Update mutation testing configuration and remove minimum stabil…
terabytesoftw Jun 28, 2025
d885491
test: Enhance deletion tests for tree nodes and verify attribute shifts.
terabytesoftw Jun 28, 2025
d6d891b
feat: Update mutation testing workflow to include static analysis com…
terabytesoftw Jun 28, 2025
daf60d7
fix: Simplify composer command in mutation testing workflow.
terabytesoftw Jun 28, 2025
e6af6b2
feat: Add phpStan configuration to `infection.json5`.
terabytesoftw Jun 28, 2025
6c1c41a
feat: Add log verbosity option to mutation testing command.
terabytesoftw Jun 28, 2025
af317f9
test: Refactor deletion tests to improve clarity and accuracy of node…
terabytesoftw Jun 28, 2025
139b336
Apply fixes from StyleCI
StyleCIBot Jun 28, 2025
1f7d3a2
fix: Correct left-right attribute shifting logic in `NestedSetsBehavi…
terabytesoftw Jun 28, 2025
7e15a56
fix: Adjust left-right attribute shifting logic in `NestedSetsBehavior`.
terabytesoftw Jun 28, 2025
1ce4a5b
fix: Improve null handling for left-right attribute values in `afterU…
terabytesoftw Jun 28, 2025
d1b8234
refactor: Simplify node movement logic in `afterUpdate()` and `before…
terabytesoftw Jun 28, 2025
0f780ca
Apply fixes from StyleCI
StyleCIBot Jun 28, 2025
176fc76
fix: Use nullsafe operator for node check in beforeInsert method and …
terabytesoftw Jun 28, 2025
623460c
fix: Remove unnecessary node refresh calls in beforeInsert and before…
terabytesoftw Jun 28, 2025
68a3895
fix: Correct left-right attribute shifting logic in `NestedSetsBehavi…
terabytesoftw Jun 29, 2025
7a0b9c6
fix: Correct logic for appending nodes in `NestedSetsBehavior` and ad…
terabytesoftw Jun 29, 2025
053f00a
test: Add tests for appending nodes to existing child nodes and verif…
terabytesoftw Jun 29, 2025
9c40d4b
fix: Update right attribute handling in beforeInsertNode for appendin…
terabytesoftw Jun 29, 2025
0176e5e
fix: Simplify mutation job configuration by removing unnecessary comm…
terabytesoftw Jun 29, 2025
49aac8a
fix: Add tools configuration for infection in mutation job.
terabytesoftw Jun 29, 2025
4786d28
fix: Remove unnecessary tools configuration from mutation job.
terabytesoftw Jun 29, 2025
483e39e
fix: Correct typo in development configuration for mutation job.
terabytesoftw Jun 29, 2025
e731f47
fix: Correct typo in development configuration in mutation job.
terabytesoftw Jun 29, 2025
43ca033
Merge branch 'main' into fix-mini-8
terabytesoftw Jun 29, 2025
c4ef00b
Merge branch 'main' into fix-mini-8
terabytesoftw Jun 29, 2025
b4f9f58
Merge branch 'main' into fix-mini-8.
terabytesoftw Jun 29, 2025
e73830d
Merge branch 'main' into fix-mini-8
terabytesoftw Jun 29, 2025
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
27 changes: 27 additions & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'

name: mutation test

jobs:
mutation:
uses: php-forge/actions/.github/workflows/infection.yml@main
with:
command-options: --static-analysis-tool=phpstan --threads=2 --ignore-msi-with-no-mutations --only-covered
composer-command: composer require --dev infection/infection:dev-master
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
"config": {
"sort-packages": true,
"allow-plugins": {
"infection/extension-installer": true,
"phpstan/extension-installer": true,
"yiisoft/yii2-composer": true
}
},
"scripts": {
"check-dependencies": "./vendor/bin/composer-require-checker check",
"ecs": "./vendor/bin/ecs --fix",
"mutation": "./vendor/bin/infection --threads=4 --ignore-msi-with-no-mutations --only-covered --min-msi=100 --min-covered-msi=100",
"rector": "./vendor/bin/rector process src",
"static": "./vendor/bin/phpstan --memory-limit=512M",
"tests": "./vendor/bin/phpunit"
Expand Down
12 changes: 5 additions & 7 deletions infection.json.dist → infection.json5
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"source": {
"directories": [
"src"
]
},
"$schema": "vendor/infection/infection/resources/schema.json",
"logs": {
"text": "php:\/\/stderr",
"stryker": {
"report": "main"
}
},
"mutators": {
"@default": true
"source": {
"directories": [
"src"
]
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheDirectory="runtime/.phpunit.cache"
colors="true"
Expand Down
50 changes: 50 additions & 0 deletions tests/NestedSetsBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1620,4 +1620,54 @@ public function makeRoot(): bool

$node->makeRoot();
}

public function testAfterDeleteShiftsLeftRightAttributesCorrectly(): void
{
$this->generateFixtureTree();

$nodeToDelete = Tree::findOne(4);

self::assertNotNull($nodeToDelete);
self::assertTrue($nodeToDelete->isLeaf());
self::assertEquals(4, $nodeToDelete->getAttribute('lft'));
self::assertEquals(5, $nodeToDelete->getAttribute('rgt'));

$node5 = Tree::findOne(5);

self::assertNotNull($node5);
self::assertEquals(6, $node5->getAttribute('lft'));
self::assertEquals(7, $node5->getAttribute('rgt'));

$node6 = Tree::findOne(6);

self::assertNotNull($node6);
self::assertEquals(9, $node6->getAttribute('lft'));
self::assertEquals(14, $node6->getAttribute('rgt'));

$node3 = Tree::findOne(3);

self::assertNotNull($node3);
self::assertEquals(3, $node3->getAttribute('lft'));
self::assertEquals(8, $node3->getAttribute('rgt'));

$result = $nodeToDelete->delete();

self::assertEquals(1, $result);
self::assertNull(Tree::findOne(4));

$node5->refresh();

self::assertEquals(4, $node5->getAttribute('lft'));
self::assertEquals(5, $node5->getAttribute('rgt'));

$node6->refresh();

self::assertEquals(7, $node6->getAttribute('lft'));
self::assertEquals(12, $node6->getAttribute('rgt'));

$node3->refresh();

self::assertEquals(3, $node3->getAttribute('lft'));
self::assertEquals(6, $node3->getAttribute('rgt'));
}
}
Loading