nerds-and-company / craft-unit-test-suite
This package is abandoned and no longer maintained.
No replacement package was suggested.
A library that helps you mocking Craft database/model classes
Package info
github.com/nerds-and-company/craft-unit-test-suite
pkg:composer/nerds-and-company/craft-unit-test-suite
1.0.1
2015-11-26 09:37 UTC
Requires
- php: >= 5.3
This package is not auto-updated.
Last update: 2022-11-30 10:06:47 UTC
README
PHPUnit test suit helps you with mocking several craft services and classes.
It enable you to:
- Configure any abstract classes you wish to load before running unit tests
- Save time by not having to manually mock Craft's database models and it's required classes
- Simply override or add extra methods to the mocked classes mocked in UnitTestSuite_AbstractTest
Requirements:
- PHP 5.4+
- Craft 2.4+
Installation:
The library can be installed using Composer.
composer require nerds-and-company/unit-test-suite ~1.0.0
Classes:
The library is composed of two classes:
UnitTestSuite_AbstractTestis the abstract class you can extend that contains the mocked Craft database classesAbstractTestLoaderis used to load custom abstract classes that for example extend UnitTestSuite_AbstractTest and add extra functionality
Usage
- Make sure the phpunit bootstrap points at
bootstrap="vendor/unittestsuite/src/bootstrap.php - Copy the
unittestsuite.ymlsupplied with this package/craft/configand add extra (abstract) classes you wish to pre-load - Extend
UnitTestSuite_AbstractTestand override or add extra data to the returned mocks - Calling $this->mockCraftDb() should cover most of the Craft DB methods