- Can I use php-ds/tests in Laravel CI to validate php-ds v2 dependencies?
- Yes, but only if your project uses PHP 8.2+. The test suite runs independently of Laravel and is ideal for catching regressions in php-ds data structures like vectors or maps. Ensure your CI environment matches the PHP version requirement to avoid warnings.
- What happens if my Laravel project uses PHPUnit 9.x but php-ds/tests requires PHPUnit 11+?
- You’ll need to explicitly override PHPUnit versions in your `composer.json` or `phpunit.xml` to avoid conflicts. Laravel’s default PHPUnit 9.x may not support all assertions in PHPUnit 11+, so test behavior could differ. Check your test suite for compatibility issues.
- Are there breaking changes if I extended CollectionTest in my custom test classes?
- Yes, the test class names were renamed (e.g., `CollectionTest` may no longer exist). You’ll need to update any custom test classes to match the new naming convention (e.g., `SeqTest`, `HeapTest`). This is a high-risk change for existing test suites.
- Does php-ds/tests work with Laravel’s Collection or Arrayable traits?
- No, this package is for validating the **php-ds** extension’s native data structures (e.g., `Vector`, `Map`) and isn’t designed to interact with Laravel’s `Collection` or `Arrayable`. Use it only if your project directly depends on php-ds v2.
- How do I add php-ds/tests to my Laravel project’s CI pipeline?
- Since it’s not a Composer package, you must manually add the GitHub repository to your `composer.json` under `repositories`. Then require it as a dev dependency. Example: `composer require php-ds/tests --dev`. Configure your CI to run the tests in a PHP 8.2+ environment.
- Will php-ds/tests slow down my Laravel CI pipeline?
- Yes, the suite is comprehensive and tests edge cases for all php-ds structures. If you only need to validate specific data structures, consider running targeted test classes (e.g., `php vendor/bin/phpunit --filter SeqTest`) to reduce execution time.
- Are there alternatives to php-ds/tests for testing data structures in Laravel?
- If you’re not using php-ds, Laravel’s built-in `Collection` tests or PHP’s native `Spl*` classes (e.g., `SplDoublyLinkedList`) may suffice. For php-ds v1, you’d need legacy test suites, but php-ds/tests only supports v2. Evaluate whether php-ds is worth the PHP 8.2+ constraint.
- How do I handle PHP 8.2+ warnings in Laravel if I can’t upgrade yet?
- You can’t use php-ds/tests without PHP 8.2+. Instead, suppress warnings in your CI (not recommended) or maintain a parallel environment for php-ds validation. Alternatively, avoid php-ds and use Laravel’s `Collection` or `Spl*` classes for similar functionality.
- Does php-ds/tests support Laravel’s testing helpers like `$this->assertDatabaseHas()`?
- No, this package is purely for php-ds validation and doesn’t integrate with Laravel’s testing helpers. It’s designed for low-level data structure correctness, not application-layer assertions. Use Laravel’s testing tools separately.
- What should I do if I get autoloading errors after adding php-ds/tests to Laravel?
- Ensure the package isn’t accidentally loaded in your Laravel autoloader. Since it’s a test suite, it should only run in CI or test environments. If errors persist, check for namespace collisions or exclude the package from Laravel’s `autoload-dev` in `composer.json`.