Download the PHP package greys/wc-smart-coupons-tests without Composer
On this page you can find all versions of the php package greys/wc-smart-coupons-tests. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download greys/wc-smart-coupons-tests
More information about greys/wc-smart-coupons-tests
Files in greys/wc-smart-coupons-tests
Package wc-smart-coupons-tests
Short Description PHPUnit testing framework for WooCommerce Smart Coupons
License MIT
Informations about the package wc-smart-coupons-tests
WooCommerce Smart Coupons PHPUnit Framework
A comprehensive PHPUnit testing framework for WooCommerce Smart Coupons extensions. This package provides helper classes, mock objects, and custom assertions to make testing Smart Coupons functionality easier and more reliable.
Features
- Base Test Case: Specialized
UnitTestCasewith Smart Coupons-specific setup - Helper Classes: Create store credit, gift cards, combination coupons, and more
- Mock Objects: Test without requiring the full Smart Coupons plugin
- Custom Assertions: Domain-specific assertions for coupon testing
- Realistic Test Data: Examples using production-like data patterns
Installation
Requirements
- PHP 7.4 or higher
- PHPUnit 9.x
- WooCommerce
greys/woocommerce-phpunit-framework
Quick Start
1. Extend the Base Test Case
2. Use Helper Classes
3. Use Custom Assertions
Available Helper Methods
Coupon
Store Credit
Gift Cards
Combination Coupons
URL Coupons
Product Credit
Utilities
Complete Test Example
Testing Tips
1. Clean Up After Tests
2. Test Edge Cases
3. Test Customer Restrictions
4. Test Generation Logic
Common Issues
Issue: Mock Smart Coupon class not found
Solution: Ensure your bootstrap file loads the mock:
Issue: Coupon not saving meta data
Solution: Call $coupon->save() after setting meta:
Issue: Customer balance calculation incorrect
Solution: Ensure only unused coupons are counted:
WooCommerce Coding Standards
This framework follows WooCommerce coding standards:
- Indentation: Use tabs, not spaces
- Arrays: Use
array()instead of[] - PHPDoc: Include
@package,@since,@returntags - Comments: End with periods ("// Arrange." not "// Arrange")
- Naming: Use snake_case for functions and variables
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request with tests
License
MIT License - See LICENSE file for details.
Support
For questions about using this framework:
- Check the examples in this README
- Review the test files in your project
- Consult the WooCommerce PHPUnit Framework documentation