Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tests Laravel Package

php-ds/tests

Test suite for php-ds, validating core data structure behavior, edge cases, and performance across releases. Includes PHPUnit-based coverage for vectors, maps, sets, queues, stacks, and iterators to ensure consistent, reliable API compatibility.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Tests
Can I use php-ds/tests to validate php-ds for Laravel caching or queue systems?
Yes, but indirectly. This test suite validates php-ds core behavior (e.g., Map edge cases like 0.0 keys) to ensure reliability in custom Laravel services. It won’t integrate with Laravel’s Cache or Queue APIs—you’d need to write separate tests for those integrations using Laravel’s testing tools.
Will php-ds/tests work with Laravel’s default PHPUnit 9 or 10?
No. This package requires PHPUnit 11, which may conflict with Laravel’s default setup (PHPUnit 9 for Laravel 9, 10 for Laravel 10). You’ll need to configure a separate test environment or upgrade Laravel’s PHPUnit, which could introduce compatibility risks.
How do I test php-ds-backed Laravel services (e.g., a Heap-based scheduler) with this suite?
You can’t directly use this suite for Laravel services. Instead, borrow test patterns (e.g., trait-per-method) to write custom Laravel tests. For example, adapt `HeapTest` traits to test your scheduler’s Heap operations, but use Laravel’s testing helpers like `RefreshDatabase` or `createModel()` where needed.
Does this package help compare php-ds performance against Laravel’s Collection?
Indirectly. The test suite includes performance benchmarks for php-ds data structures (e.g., Map vs. Collection for key-value storage). Run the tests in a Laravel-compatible environment, then replicate scenarios in your app to compare results—but expect manual effort to bridge the gap.
Can I integrate php-ds/tests into Laravel’s test suite (e.g., Pest or PHPUnit)?
No. This suite is PHPUnit-centric and lacks Laravel-specific features (e.g., HTTP assertions, database transactions). You’d need to rewrite tests or run them in isolation, which adds maintenance overhead. For Laravel testing, use Pest or Laravel’s built-in tools.
What Laravel versions support php-ds/tests if I use it for custom packages?
Laravel version support depends on your PHP and PHPUnit setup. Since this suite requires PHP 8.2+ and PHPUnit 11, it’s compatible with Laravel 10+ (PHP 8.1+) or Laravel 11+ (PHP 8.2+). For Laravel 9, you’d need to manually resolve PHPUnit 11 conflicts.
Are there Laravel-specific edge cases this test suite covers (e.g., Eloquent relationships)?
No. This suite focuses on php-ds core functionality (e.g., iterator behavior, memory limits) and has no Laravel-specific tests. For Eloquent or relationship testing, use Laravel’s built-in tools or packages like `laravel-testing` instead.
Should I use php-ds/tests if I’m not adopting php-ds in Laravel?
No. This package is only useful if you’re evaluating or using php-ds in custom Laravel services. If you’re sticking with Laravel’s Collection or Spl*, skip this suite—it adds no direct value. Focus on Laravel’s native testing tools instead.
How do I benchmark php-ds in a Laravel app using this test suite?
Run the suite’s benchmarks in a standalone PHP environment, then replicate the same operations in your Laravel app (e.g., timing Map insertions vs. Laravel’s Collection). Use tools like `laravel-debugbar` or custom timers to compare results in a real-world context.
What alternatives exist for testing data structures in Laravel without php-ds/tests?
For Laravel-specific testing, use Laravel’s built-in tools: Collections (for in-memory data), Eloquent (for database-backed structures), or packages like `spatie/array-to-object` for custom transformations. For performance benchmarks, leverage PHP’s `microtime()` or libraries like `perf`.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata