-
Running PHP Tests
Vanilla uses PHPUnit for testing it's backend code. Tests are written in PHP and can be easily run the from command line, or more commonly using PHPStorm. Required Test Setup The easiest way to get the full test harness setup is to use vanilla-docker. After setting up vanilla docker, you will need to ensure you have a…
-
Writing PHP Tests
Vanilla has numerous testing utilities to make automated testing easier. A test will automatically be run in CI if it meets the following conditions. The filename matches the following pattern: *Test.php. The classname matches the filename. The class extends in some way \PHPUnit\Framework\TestCase. Base Classes Vanilla has…
-
EventSpyTestTrait
The EventSpyTestTrait is used for tests that want to assert various events are fired. PSR Event Dispatcher The event manager allows firing of PSR-14 compliant events for newer things like ResourceEvents. Vanilla offers a few utilities to test them clearDispatchedEvents() - Clear any previously dispatched events.…
-
API Utility Test Traits
Vanilla has various traits for easily creating and testing data through API endpoints. These generally have a suffix ApiTestTrait. The expect to be used on test cases that use SiteTestTrait or AbstractApiV2Test. Structure of the Traits The traits generally all have the following in common. Easy createThing() methods for…