diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index bc52ae0..289d5e8 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -12,7 +12,7 @@ permissions: jobs: benchmark: - + runs-on: ubuntu-latest steps: @@ -26,21 +26,31 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f with: - php-version: '8.4' + php-version: '8.5' extensions: zip, curl, mbstring, xml coverage: none + tools: composer:v2 + + # Step 2.1: Install PHPBench globally + - name: Install PHPBench + run: | + composer global require phpbench/phpbench:^1.6 --prefer-dist --no-progress --no-interaction + PHPBENCH_BIN="$(composer global config bin-dir --absolute)/phpbench" + echo "PHPBENCH_BIN=$PHPBENCH_BIN" >> "$GITHUB_ENV" + "$PHPBENCH_BIN" --version # Step 3: Install dependencies for PR branch - name: Install Composer dependencies run: | - composer install --prefer-dist --no-progress --no-suggest - composer require --dev phpbench/phpbench + # Remove dependency artifacts that can leak across branch switches in CI + git clean -ffdx -- composer.lock vendor + composer install --prefer-dist --no-progress # Step 4: Run benchmarks on PR branch - name: Run benchmarks on PR branch run: | mkdir -p tests/Benchmark - ./vendor/bin/phpbench run tests/Benchmark \ + "$PHPBENCH_BIN" run tests/Benchmark \ --report=default \ --tag=pr \ --retry-threshold=5 \ @@ -54,17 +64,41 @@ jobs: env: BASE_REF: ${{ github.base_ref }} + # Step 5.1: Diagnose Composer state on base branch + - name: Diagnose Composer state (base) + run: | + echo "Commit: $(git rev-parse --short HEAD)" + echo "Base ref: origin/$BASE_REF" + echo "phpunit/phpunit constraint in composer.json:" + grep -n '"phpunit/phpunit"' composer.json || true + + if [ -f composer.lock ]; then + echo "composer.lock present before cleanup" + php -r '$lock = json_decode(file_get_contents("composer.lock"), true); $version = "not-found"; foreach (($lock["packages-dev"] ?? []) as $pkg) { if (($pkg["name"] ?? "") === "phpunit/phpunit") { $version = $pkg["version"] ?? "unknown"; break; } } echo "locked phpunit/phpunit: {$version}\n";' + else + echo "composer.lock missing before cleanup" + fi + + echo "ignore status for composer.lock:" + git check-ignore -v composer.lock || true + + echo "git status snapshot:" + git status --short -- composer.json composer.lock vendor || true + env: + BASE_REF: ${{ github.base_ref }} + # Step 6: Install dependencies for base branch - name: Install Composer dependencies (base) run: | - composer install --prefer-dist --no-progress --no-suggest - composer require --dev phpbench/phpbench + # Ensure install uses only files from the checked out base branch + git clean -ffdx -- composer.lock vendor + composer install --prefer-dist --no-progress # Step 7: Run benchmarks on base branch - name: Run benchmarks on base branch run: | mkdir -p tests/Benchmark - ./vendor/bin/phpbench run tests/Benchmark \ + "$PHPBENCH_BIN" run tests/Benchmark \ --report=default \ --tag=base \ --retry-threshold=5 \ @@ -76,12 +110,19 @@ jobs: env: HEAD_REF: ${{ github.head_ref }} + # Step 8.1: Reinstall dependencies for PR branch + - name: Install Composer dependencies (PR, comparison) + run: | + # Prevent base branch dependency artifacts from affecting PR comparison run + git clean -ffdx -- composer.lock vendor + composer install --prefer-dist --no-progress + # Step 9: Compare benchmarks - name: Compare benchmarks with baseline id: compare run: | mkdir -p tests/Benchmark - ./vendor/bin/phpbench run tests/Benchmark \ + "$PHPBENCH_BIN" run tests/Benchmark \ --report=aggregate \ --ref=base \ --retry-threshold=5 \ diff --git a/.gitignore b/.gitignore index cf8e345..6874383 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,10 @@ composer.lock *.cache clover.xml junit-logfile.xml +tmp/ + +# Agents +.agents/ +.claude/ +.windsurf/ +skills-lock.json diff --git a/composer.json b/composer.json index 449033e..ae4d556 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0" + "phpunit/phpunit": "^4.8 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0" }, "autoload": { "psr-4": { @@ -19,5 +19,8 @@ "files": [ "src/helpers.php" ] + }, + "scripts": { + "test": ["@php vendor/bin/phpunit"] } } diff --git a/tests/ArrayCompareTest.php b/tests/ArrayCompareTest.php index 7cfc52b..4508fe4 100644 --- a/tests/ArrayCompareTest.php +++ b/tests/ArrayCompareTest.php @@ -5,15 +5,15 @@ class ArrayCompareTest extends TestCase { - /** @test */ - public function it_returns_an_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_returns_an_array() { $diff = new ArrayDiffMultidimensional(); $this->assertTrue(is_array($diff->compare([], []))); } - /** @test */ - public function it_fails_if_first_argument_is_not_an_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_fails_if_first_argument_is_not_an_array() { if (method_exists($this, 'expectException')) { $this->expectException(\InvalidArgumentException::class); @@ -26,8 +26,8 @@ public function it_fails_if_first_argument_is_not_an_array() } } - /** @test */ - public function it_does_not_change_if_second_argument_is_not_an_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_does_not_change_if_second_argument_is_not_an_array() { $diff = new ArrayDiffMultidimensional(); @@ -46,8 +46,8 @@ public function it_does_not_change_if_second_argument_is_not_an_array() $this->assertEquals($old, $diff->compare($old, $new)); } - /** @test */ - public function it_detects_the_difference_on_string_value() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_the_difference_on_string_value() { $diff = new ArrayDiffMultidimensional(); @@ -67,8 +67,8 @@ public function it_detects_the_difference_on_string_value() $this->assertFalse(isset($diff->compare($new, $old)['a'])); } - /** @test */ - public function it_detects_change_from_string_to_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_change_from_string_to_array() { $diff = new ArrayDiffMultidimensional(); @@ -90,8 +90,8 @@ public function it_detects_change_from_string_to_array() $this->assertFalse(isset($diff->compare($new, $old)['a'])); } - /** @test */ - public function it_detects_changes_on_nested_arrays() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_changes_on_nested_arrays() { $diff = new ArrayDiffMultidimensional(); @@ -116,8 +116,8 @@ public function it_detects_changes_on_nested_arrays() $this->assertFalse(isset($diff->compare($new, $old)['a'])); } - /** @test */ - public function it_detects_change_from_float_to_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_change_from_float_to_array() { $diff = new ArrayDiffMultidimensional(); $newfloat = defined('PHP_FLOAT_MAX') ? PHP_FLOAT_MAX : 1.0000000000002; @@ -139,8 +139,8 @@ public function it_detects_change_from_float_to_array() $this->assertFalse(isset($diff->compare($new, $old)['a'])); } - /** @test */ - public function it_detects_floats_do_not_change() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_floats_do_not_change() { $diff = new ArrayDiffMultidimensional(); $floatval = defined('PHP_FLOAT_MAX') ? PHP_FLOAT_MAX : 1.0000000000005; @@ -160,8 +160,8 @@ public function it_detects_floats_do_not_change() $this->assertFalse(isset($diff->compare($new, $old)['c'])); } - /** @test */ - public function it_works_with_deep_levels() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_works_with_deep_levels() { $diff = new ArrayDiffMultidimensional(); @@ -200,8 +200,8 @@ public function it_works_with_deep_levels() $this->assertFalse(isset($diff->compare($new, $old)['a'])); } - /** @test */ - public function it_detects_new_array_items() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_new_array_items() { $diff = new ArrayDiffMultidimensional(); $value = 'this should be detected'; @@ -224,8 +224,8 @@ public function it_detects_new_array_items() $this->assertFalse(isset($diff->compare($new, $old)['c'])); } - /** @test */ - public function it_detects_loose_changes_with_strict_mode() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_loose_changes_with_strict_mode() { $diff = new ArrayDiffMultidimensional(); @@ -252,8 +252,8 @@ public function it_detects_loose_changes_with_strict_mode() $this->assertEquals(1714, $diff->strictComparison($new, $old)['c']); } - /** @test */ - public function it_does_not_detect_loose_changes_without_strict_mode() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_does_not_detect_loose_changes_without_strict_mode() { $diff = new ArrayDiffMultidimensional(); @@ -274,8 +274,8 @@ public function it_does_not_detect_loose_changes_without_strict_mode() $this->assertFalse(isset($diff->looseComparison($new, $old)['c'])); } - /** @test */ - public function it_detects_epsilon_change_with_strict_mode() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_epsilon_change_with_strict_mode() { $epsilon = defined('PHP_FLOAT_EPSILON') ? PHP_FLOAT_EPSILON : 2.2204460492503E-16; @@ -290,8 +290,8 @@ public function it_detects_epsilon_change_with_strict_mode() $this->assertEquals(123, $diff->compare($new, $old)[0]); } - /** @test */ - public function it_does_not_detect_epsilon_change_with_strict_mode() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_does_not_detect_epsilon_change_with_strict_mode() { $epsilon = defined('PHP_FLOAT_EPSILON') ? PHP_FLOAT_EPSILON : 2.2204460492503E-16; $diff = new ArrayDiffMultidimensional(); @@ -303,8 +303,8 @@ public function it_does_not_detect_epsilon_change_with_strict_mode() $this->assertFalse(isset($diff->looseComparison($new, $old)[0])); } - /** @test */ - public function it_detects_empty_array_change_with_strict_mode() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_empty_array_change_with_strict_mode() { $diff = new ArrayDiffMultidimensional(); @@ -315,8 +315,8 @@ public function it_detects_empty_array_change_with_strict_mode() $this->assertTrue(isset($diff->compare($a, $b)[0])); } - /** @test */ - public function it_detects_empty_array_change_with_strict_mode_on_multiple_dimensions() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_detects_empty_array_change_with_strict_mode_on_multiple_dimensions() { $diff = new ArrayDiffMultidimensional(); @@ -341,8 +341,8 @@ public function it_detects_empty_array_change_with_strict_mode_on_multiple_dimen ], $diff->compare($new, $old)); } - /** @test */ - public function it_handles_null_values_correctly() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_null_values_correctly() { $diff = new ArrayDiffMultidimensional(); @@ -353,8 +353,8 @@ public function it_handles_null_values_correctly() $this->assertEquals(['a' => null], $result); } - /** @test */ - public function it_handles_null_vs_missing_key() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_null_vs_missing_key() { $diff = new ArrayDiffMultidimensional(); @@ -365,8 +365,8 @@ public function it_handles_null_vs_missing_key() $this->assertEquals(['a' => null], $result); } - /** @test */ - public function it_handles_false_vs_empty_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_false_vs_empty_array() { $diff = new ArrayDiffMultidimensional(); @@ -377,8 +377,8 @@ public function it_handles_false_vs_empty_array() $this->assertEquals(['a' => false, 'b' => []], $result); } - /** @test */ - public function it_handles_zero_values_correctly() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_zero_values_correctly() { $diff = new ArrayDiffMultidimensional(); @@ -392,8 +392,8 @@ public function it_handles_zero_values_correctly() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_boolean_values() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_boolean_values() { $diff = new ArrayDiffMultidimensional(); @@ -407,8 +407,8 @@ public function it_handles_boolean_values() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_mixed_numeric_types() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_mixed_numeric_types() { $diff = new ArrayDiffMultidimensional(); @@ -422,8 +422,8 @@ public function it_handles_mixed_numeric_types() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_very_small_float_differences() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_very_small_float_differences() { $diff = new ArrayDiffMultidimensional(); @@ -434,8 +434,8 @@ public function it_handles_very_small_float_differences() $this->assertEquals(['a' => 1.0000000000001], $result); } - /** @test */ - public function it_handles_array_with_numeric_keys() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_array_with_numeric_keys() { $diff = new ArrayDiffMultidimensional(); @@ -446,8 +446,8 @@ public function it_handles_array_with_numeric_keys() $this->assertEquals([1 => 'b', 2 => ['c' => 'd']], $result); } - /** @test */ - public function it_handles_empty_vs_null_in_arrays() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_empty_vs_null_in_arrays() { $diff = new ArrayDiffMultidimensional(); @@ -458,8 +458,8 @@ public function it_handles_empty_vs_null_in_arrays() $this->assertEquals(['a' => ['b' => []]], $result); } - /** @test */ - public function it_handles_nested_empty_arrays() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_nested_empty_arrays() { $diff = new ArrayDiffMultidimensional(); @@ -470,8 +470,8 @@ public function it_handles_nested_empty_arrays() $this->assertEquals(['a' => ['b' => ['c' => []]]], $result); } - /** @test */ - public function it_handles_objects_correctly() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_objects_correctly() { $diff = new ArrayDiffMultidimensional(); @@ -488,8 +488,8 @@ public function it_handles_objects_correctly() $this->assertEquals(['a' => $obj1], $result); } - /** @test */ - public function it_handles_large_nested_structures() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_large_nested_structures() { $diff = new ArrayDiffMultidimensional(); @@ -541,8 +541,8 @@ public function it_handles_large_nested_structures() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_array_to_scalar_changes() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_array_to_scalar_changes() { $diff = new ArrayDiffMultidimensional(); @@ -553,8 +553,8 @@ public function it_handles_array_to_scalar_changes() $this->assertEquals(['a' => 'scalar_value'], $result); } - /** @test */ - public function it_handles_complex_mixed_types() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_complex_mixed_types() { $diff = new ArrayDiffMultidimensional(); @@ -589,8 +589,8 @@ public function it_handles_complex_mixed_types() $this->assertEquals($expected, $result); } - /** @test */ - public function it_preserves_array_structure_in_results() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_preserves_array_structure_in_results() { $diff = new ArrayDiffMultidimensional(); @@ -618,8 +618,8 @@ public function it_preserves_array_structure_in_results() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_performance_with_large_arrays() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_performance_with_large_arrays() { $diff = new ArrayDiffMultidimensional(); diff --git a/tests/ArrayDiffEdgeCasesTest.php b/tests/ArrayDiffEdgeCasesTest.php index 3452714..2d0b0d9 100644 --- a/tests/ArrayDiffEdgeCasesTest.php +++ b/tests/ArrayDiffEdgeCasesTest.php @@ -5,8 +5,8 @@ class ArrayDiffEdgeCasesTest extends TestCase { - /** @test */ - public function it_handles_array_key_exists_vs_isset_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_array_key_exists_vs_isset_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -25,8 +25,8 @@ public function it_handles_array_key_exists_vs_isset_edge_cases() $this->assertEquals(['existing' => null], $result); } - /** @test */ - public function it_handles_false_vs_zero_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_false_vs_zero_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -42,8 +42,8 @@ public function it_handles_false_vs_zero_edge_cases() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_empty_string_vs_null_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_empty_string_vs_null_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -57,8 +57,8 @@ public function it_handles_empty_string_vs_null_edge_cases() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_numeric_string_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_numeric_string_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -74,8 +74,8 @@ public function it_handles_numeric_string_edge_cases() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_resource_values() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_resource_values() { $diff = new ArrayDiffMultidimensional(); @@ -99,8 +99,8 @@ public function it_handles_resource_values() fclose($resource2); } - /** @test */ - public function it_handles_callable_values() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_callable_values() { $diff = new ArrayDiffMultidimensional(); @@ -125,8 +125,8 @@ public function it_handles_callable_values() $this->assertEquals([], $result); } - /** @test */ - public function it_handles_array_vs_object_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_array_vs_object_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -141,8 +141,8 @@ public function it_handles_array_vs_object_edge_cases() $this->assertEquals(['item' => $array], $result); } - /** @test */ - public function it_handles_nested_array_vs_scalar_transitions() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_nested_array_vs_scalar_transitions() { $diff = new ArrayDiffMultidimensional(); @@ -171,8 +171,8 @@ public function it_handles_nested_array_vs_scalar_transitions() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_very_large_float_precision() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_very_large_float_precision() { $diff = new ArrayDiffMultidimensional(); @@ -195,8 +195,8 @@ public function it_handles_very_large_float_precision() $this->assertTrue(is_array($result)); } - /** @test */ - public function it_handles_float_precision_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_float_precision_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -254,8 +254,8 @@ public function it_handles_float_precision_edge_cases() // $this->assertEquals(['denorm' => 4.9e-324], $result); } - /** @test */ - public function it_handles_float_string_conversion_edge_cases() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_float_string_conversion_edge_cases() { $diff = new ArrayDiffMultidimensional(); @@ -284,8 +284,8 @@ public function it_handles_float_string_conversion_edge_cases() $this->assertArrayHasKey('small_precise', $result); } - /** @test */ - public function it_handles_float_comparison_in_nested_structures() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_float_comparison_in_nested_structures() { $this->markTestSkipped('Pending implementation of improved float comparison logic in nested structures.'); @@ -330,8 +330,8 @@ public function it_handles_float_comparison_in_nested_structures() $this->assertTrue(is_array($result)); // Should not crash with complex nested float comparisons } - /** @test */ - public function it_handles_empty_arrays_at_different_nesting_levels() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_empty_arrays_at_different_nesting_levels() { $diff = new ArrayDiffMultidimensional(); @@ -363,8 +363,8 @@ public function it_handles_empty_arrays_at_different_nesting_levels() $this->assertEquals($new, $result); } - /** @test */ - public function it_handles_circular_reference_prevention() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_circular_reference_prevention() { $diff = new ArrayDiffMultidimensional(); @@ -386,8 +386,8 @@ public function it_handles_circular_reference_prevention() $this->assertEquals(['circular' => $obj1], $result); } - /** @test */ - public function it_handles_array_keys_with_special_characters() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_array_keys_with_special_characters() { $diff = new ArrayDiffMultidimensional(); diff --git a/tests/ArrayDiffIntegrationTest.php b/tests/ArrayDiffIntegrationTest.php index 5e770d7..4b49811 100644 --- a/tests/ArrayDiffIntegrationTest.php +++ b/tests/ArrayDiffIntegrationTest.php @@ -5,8 +5,8 @@ class ArrayDiffIntegrationTest extends TestCase { - /** @test */ - public function it_handles_real_world_configuration_arrays() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_real_world_configuration_arrays() { $diff = new ArrayDiffMultidimensional(); @@ -81,8 +81,8 @@ public function it_handles_real_world_configuration_arrays() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_user_profile_updates() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_user_profile_updates() { $diff = new ArrayDiffMultidimensional(); @@ -167,8 +167,8 @@ public function it_handles_user_profile_updates() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_api_response_comparison() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_api_response_comparison() { $diff = new ArrayDiffMultidimensional(); @@ -224,8 +224,8 @@ public function it_handles_api_response_comparison() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_shopping_cart_updates() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_shopping_cart_updates() { $diff = new ArrayDiffMultidimensional(); @@ -310,8 +310,8 @@ public function it_handles_shopping_cart_updates() $this->assertEquals($expected, $result); } - /** @test */ - public function it_handles_form_data_validation_errors() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_form_data_validation_errors() { $diff = new ArrayDiffMultidimensional(); @@ -352,8 +352,8 @@ public function it_handles_form_data_validation_errors() $this->assertEquals($expected, $result); } - /** @test */ - public function it_maintains_performance_with_complex_real_world_data() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_maintains_performance_with_complex_real_world_data() { $diff = new ArrayDiffMultidimensional(); diff --git a/tests/ArrayDiffPerformanceTest.php b/tests/ArrayDiffPerformanceTest.php index 405845c..390be5b 100644 --- a/tests/ArrayDiffPerformanceTest.php +++ b/tests/ArrayDiffPerformanceTest.php @@ -5,8 +5,8 @@ class ArrayDiffPerformanceTest extends TestCase { - /** @test */ - public function it_handles_deeply_nested_identical_arrays_efficiently() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_deeply_nested_identical_arrays_efficiently() { $diff = new ArrayDiffMultidimensional(); @@ -20,8 +20,8 @@ public function it_handles_deeply_nested_identical_arrays_efficiently() $this->assertLessThan(0.1, $end - $start, 'Should handle identical nested arrays quickly'); } - /** @test */ - public function it_handles_wide_arrays_efficiently() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_wide_arrays_efficiently() { $diff = new ArrayDiffMultidimensional(); @@ -45,8 +45,8 @@ public function it_handles_wide_arrays_efficiently() $this->assertLessThan(0.5, $end - $start, 'Should handle wide arrays efficiently'); } - /** @test */ - public function it_handles_mixed_depth_arrays_efficiently() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_mixed_depth_arrays_efficiently() { $diff = new ArrayDiffMultidimensional(); @@ -70,8 +70,8 @@ public function it_handles_mixed_depth_arrays_efficiently() $this->assertLessThan(0.2, $end - $start, 'Should handle mixed depth arrays efficiently'); } - /** @test */ - public function it_handles_arrays_with_many_empty_subarrays() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_arrays_with_many_empty_subarrays() { $diff = new ArrayDiffMultidimensional(); @@ -94,8 +94,8 @@ public function it_handles_arrays_with_many_empty_subarrays() $this->assertLessThan(0.1, $end - $start, 'Should handle many empty arrays efficiently'); } - /** @test */ - public function it_handles_arrays_with_many_null_values() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_handles_arrays_with_many_null_values() { $diff = new ArrayDiffMultidimensional(); diff --git a/tests/HelperFunctionTest.php b/tests/HelperFunctionTest.php index c564f65..77699ce 100644 --- a/tests/HelperFunctionTest.php +++ b/tests/HelperFunctionTest.php @@ -4,14 +4,14 @@ class HelperFunctionTest extends TestCase { - /** @test */ - public function it_returns_an_array() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_returns_an_array() { $this->assertTrue(is_array(array_diff_multidimensional([], []))); } - /** @test */ - public function it_calls_compare_method() + #[\PHPUnit\Framework\Attributes\Test] + public function test_it_calls_compare_method() { $new = [ 'a' => 'b', @@ -39,8 +39,8 @@ public function it_calls_compare_method() ); } - /** @test */ - public function loose_comparisons() + #[\PHPUnit\Framework\Attributes\Test] + public function test_loose_comparisons() { $new = [ 'a' => 'b', @@ -56,8 +56,8 @@ public function loose_comparisons() $this->assertFalse(isset(array_diff_multidimensional($new, $old, false)['c'])); } - /** @test */ - public function strict_comparisons() + #[\PHPUnit\Framework\Attributes\Test] + public function test_strict_comparisons() { $new = [ 'a' => 'b',