- What is atoum/ruler-extension used for?
- atoum/ruler-extension is an atoum test framework extension for working with business rules built using the Hoa\Ruler rule engine. It adds assertions that let you express and verify rule behavior directly in atoum test suites. It is useful when rule sets are a core part of your application logic and you want those rules covered by tests.
- How do I install atoum/ruler-extension with Composer?
- Install it as a development dependency with Composer using composer require --dev atoum/ruler-extension. Because it is a testing extension, it normally belongs in require-dev rather than production dependencies. After installation, enable the extension in your atoum configuration or bootstrap according to the package README.
- Does atoum/ruler-extension work with Laravel?
- The package is not Laravel-specific; it targets atoum test suites. You can use it in a Laravel project if that project runs atoum tests, but it does not replace Laravel's default PHPUnit or Pest setup by itself. You would need to integrate atoum into your Laravel testing workflow separately.
- Which Laravel and PHP versions are supported?
- Support depends on the package's Composer constraints for atoum, Hoa\Ruler, and PHP, not on a Laravel version directly. Check the composer.json requirements and the README for the supported PHP and atoum versions. For Laravel projects, confirm compatibility with the PHP version used by your application.
- How do I enable the ruler extension in atoum?
- Atoum extensions are typically registered in your atoum configuration file or test bootstrap. Add the ruler extension there so its assertions are available in your test suites. The exact class name and registration snippet should be taken from the package README to match your installed version.
- What assertions does it add for testing Ruler rules?
- The extension adds assertions for evaluating Hoa\Ruler rules against a given context in atoum tests. This lets you verify which rules match or fail for specific data instead of testing the rule engine indirectly. Refer to the README for the exact assertion methods and their argument order.
- Can I use atoum/ruler-extension to filter tests by rule?
- The package overview describes filtering tests using Hoa\Ruler, while the blurb emphasizes assertions for rule sets. In practice, it is intended to make rule-based behavior expressible in atoum specs, including checking which rules apply to a context. Review the documented API to confirm the filtering behavior available in your version.
- How does atoum/ruler-extension compare with PHPUnit or Pest for rule testing?
- PHPUnit and Pest do not provide built-in assertions for Hoa\Ruler rules; you would write custom assertions or helper methods yourself. This extension is specific to atoum and provides rule-aware assertions out of the box for atoum suites. Choose it only if your project already uses atoum or you are willing to adopt it.
- Is atoum/ruler-extension safe to use in production?
- It is a testing extension and should be installed as a development dependency, so it should not be loaded in production application code. Keep it in require-dev and ensure your production Composer install excludes dev dependencies. As with any package, review its maintenance status and test it in CI before relying on it.
- What are alternatives to atoum/ruler-extension?
- Alternatives include testing Hoa\Ruler rules directly with your existing PHPUnit or Pest assertions, writing small custom assertion helpers, or using Ruler's own evaluation API inside tests. If you already use atoum, this extension is the most direct option for rule-specific assertions. Evaluate maintenance and compatibility before choosing an approach.