All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Define a
thumbnail
relationship on the post model that when defined will return an attachment model.
- Post factories that are passed a term slug to
with_terms()
will create the term if it doesn't exist by default. This can be disabled by calling thecreate_terms()
method on the factory or replacing the with terms method call withwith_terms_only_existing()
.
- Attachment factories now properly use the
Attachment_Factory
class. - Ensure that the
delete()
method of the HTTP Client doesn't set a body by default. - Ensure that
with_terms()
can support an array of term slugs when passed with a taxonomy index. - Ensure that framework configuration respects the application configuration.
- Add support for dispatching jobs to the queue after the current response has been sent.
- Allow the block factory to override text when generating blocks.
- Added new
defer()
helper. - Added
Cache::flexible()
method to add SWR support to the cache. - Added support for parallel unit testing with
brianium/paratest
(in beta). - Added dynamic creation of post type/taxonomy factories.
- Added
Reset_Server
trait to reset the server between tests. - Add
with_https()
to control if the request being tested is over HTTPS. - Add
andReturnBoolean()
andandReturn( fn ( $value ) => ... )
support to action/filter expectations - Add cached HTTP response support using the
cache()
method.
- Breaking: Http Client pools should now be built using
->method()
and->url()
instead. - Dropped support for Redis as a cache backend in favor of the default object cache drop-in.
- Allow returning falsey from
Collection::map_to_dictionary()
.
- Added a
with_image()
helper to mocked HTTP responses. - Added a
is_blob()
andis_file()
helper toMantle\Http_Client\Response
. - Added
with_real_thumbnail()
method to post factory for creating posts with real underlying thumbnail files.
- Added support for faking specific HTTP requests by method.
- Added helper for fluently building HTTP sequence responses.
- Fixed an issue with taxonomy registration not returning an array.
- Fixed issue with the
mantle-framework/testkit
package depending on classes that do not exist for that package (introduced in v1.1.0).
- Add a
with_json()
helper to the HTTP client to send JSON data in a request.
- Added types to the HTTP client methods.
- Fix the order of the
vip-config.php
loading that was added during 1.0.
- Added a
classname
/the_classname
helper to generate complex class names. - Added support for installing the Redis
object-cache.php
drop-in during testing withwith_object_cache()
. - Added support for PHPUnit 11.
- Overhauled the bootloader to be more flexible and allow for more customization. Supports passing configuration, custom kernels, exception handlers, etc. via the bootloader when configuring the application.
- Ensure that framework configuration is properly merged into application configuration when booting the application. This allows for slimmer configuration files in the application. Service providers will always load without needing to be declared in the application configuration.
- Load the
wp-content/vip-config/vip-config.php
file if it exists during testing to integrate better with VIP Go projects.
- Fixed issue with command jobs not working properly.
- Ensure that unit tests fail when a project's installation script fails.
- Fix anonymous queue jobs from WP-CLI failing to run.
- Fixed issue with HTTP Client not returning the proper headers.
- Added a
block_factory()
helper to generate blocks in tests.
- Changed
Hookable
to accept all arguments passed to theadd_action()
andadd_filter()
functions.
- Prevent sending mail during the install
wp_install()
call in unit tests by mocking the$phpmailer
global earlier. - Allow anonymous models to define events via
Model::created()
methods. - Fixed the Collision printer with PHPUnit 10.
- Properly disabling VIP's alloptions protections during unit testing (previously applied in v1.0.5).
- Disable VIP's
pre_wp_load_alloptions_protections
protection during unit testing.
- Define the
WP_RUN_CORE_TESTS
constant during unit tests.
- Ensure that dumping the content dumps non-json content,
- Proper unset server headers when testing.
- Added
html_string()
helper to make assertions against a HTML string easier in testing. - Added new assertion methods to test against elements.
- Fixed incorrect status code when testing.
- Properly tear down the
$wp_the_query
global.
- Changed the timing of the
set_up
method being called in tests to be after the database transaction is started. - Allow other use of the
pre_http_request
filter when preventing external requests during testing. - Fixed an issue with the streamed HTTP response not being converted to a
WP_Error
when needed.
- Added support for PHP 8.3.
- Add support for querying against against enum values in the database.
- PHPUnit 10 support added and
nunomaduro/collision
depend on to v6-7. See PHPUnit 10 Migration for more information. - Adds database-specific collections with storage of the
found_rows
value. - Added testing against
wp_mail()
calls. - Added assertions for elements by query selector (
assertElementExistsByQuerySelector()
andassertElementMissingByQuerySelector()
). - Added
Hookable
support trait. - Added support for authentication via an attribute on a test case/method.
- Added new
map()
method to the query builder.
- Database queries against models now return an instance of
Mantle\Database\Query\Collection
which includes thefound_rows
value. - Overhauled queue performance and added admin interface.
- Tests that make requests using
$this->get()
and other HTTP methods will now use a fluent pending request classMantle\Testing\Pending_Testable_Request
to allow for more complex request building. - Upgraded Symfony components to 6.2.
- Allow meta to be set as an array on a model.
- Removed support for PHP 8.0. The minimum PHP version is now 8.1.
When upgrading to Mantle v1 projects will receive phpunit/phpunit
v10 and
nunomaduro/collision
v7. PHPUnit 10 requires PSR-4 file structure for tests
(tests/Feature/MyExampleTest.php
vs tests/feature/test-my-example.php
). If
you have tests written in the old style, you will need to migrate them to PSR-4.
If you wish to continue using PHPUnit 9, you will need to downgrade to PHPUnit
9/Collision 6. To do so, run the following command:
composer require --dev phpunit/phpunit:^9 nunomaduro/collision:^6 -W
To upgrade an existing test suite to PHPUnit 10 and PSR-4 standards, consider
using a helper tool. You
will also need to adjust your phpunit.xml
file:
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
- printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer"
>
<testsuites>
<testsuite name="general">
- <directory prefix="test-" suffix=".php">tests</directory>
+ <directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
</phpunit>
If you plan on using PHPUnit 10 and previously declared the phpunit/phpunit
version in your composer.json
file, now would be a good time to remove it and
allow Mantle to manage that.
- Adding support back for
alleyinteractive/wp-filter-side-effects
1.0.
- Allow Windows drive paths.
- Removed PHPUnit 10 support to prevent a breaking change. Moved to 1.x.
- Added PHPUnit 10 support.
- Adding block assertions to strings.
- Allow partial matching of HTML content by xpath selectors.
- Add a shutdown handler to the installation script to prevent silent fatals.
- Ensure factories can be used with data providers.
- Adding date query builder for posts.
- Adds a trait to easily silence remote requests during testing.
- Improve the messaging of assertions when testing.
- Ensure that attribute and action methods are deduplicated in service providers.
- Fix issue with custom post types/taxonomies and factories not resuming the correct post type/taxonomy after creation.
- Improved the performance of the
with_image()
method on attachment factories.
- Added
with_active_plugins()
method to the installation manager to set the active plugins after installation. - Added the
install_plugin()
method to the installation manager to install a plugin from WordPress.org or a remote URL.
- Fixed an issue where the console kernel was not booting unless running
wp mantle
directly.
- Add better support for a query modifier on a relationship.
- Add
whereRaw()
for querying against raw attributes in a SQL query.
- Fixed an issue when saving multiple models.
No changes, just a re-release to fix a bad tag.
- Introduce a flexible Application Bootloader.
- Allow dynamic instance of a model to be created without defining the model class.
- Add facade docblocks and phpdoc block generation script.
- Stringable and updated Str class.
- Vendor Publishable Assets.
- Add first_or_new/first_or_create/update_or_create methods.
- New assertion helpers.
- Adding PHP 8.2 support.
- Allow JSON to be POST-ed to requests when testing.
- Adding chunk()/chunk_by_id()/each()/each_by_id() methods to the query builder, fixing order by aliases.
- Add dump/dumpSql/dd/ddSql to the query builder.
- Add testing for prefer-lowest.
- Add snapshot testing.
- Fix an error when typehinting and using request variables.
- Fix generator namespaces.
- Fix http-client content_type method by @nlemoine.
- Ensure that REST API headers are persisted when testing.
- Remove Guzzle HTTP and move to WordPress Http Client.
- Refresh application routing and add tests.
- Improve the handling of various arguments to with_terms().
- Refactor Factories for simplicity and to combine with testing factories.
- Updating factory generators/stubs.
- Requiring
symfony/console
, upgrading topsr/log
3.0. - Ensure that faker can always generate Gutenberg blocks.
- @nlemoine made their first contribution in #409
Full Changelog: https://github.com/alleyinteractive/mantle-framework/compare/v0.11.3...v0.12.0
- Allow the default database configuration to be customized via environment
variables:
WP_DB_NAME
,WP_DB_USER
,WP_DB_PASSWORD
,WP_DB_HOST
.
- Add back-support for WordPress 6.0 when testing.
- Add support for using SQLite in tests (opt-in).
- Add support for rsync-ing mu-plugins and adding object-cache.php during testing.
- Assorted fixes from/to support PHPStan (we're now at level 5 with plans to increase).
- Remove any reference to
LazyCollection
.
- Add a
with_image()
helper to create an attachment with a real image.
- Remove duplicate
rsync_exclusions
keys inRsync_Installation
. - Handle some edge cases when running wp-cli on VIP
- Fixing issue with core test case shim.
- Set better defaults for registering meta.
- Improving rsyncing and phpunit path detection during unit tests.
- Introduce a WP_UnitTestCase class and a core shim to the testing framework.
- Improve reporting of stray HTTP requests during unit tests.
- Allow json to be dumped from the testing response.
- Make
wp_insert_post
returnWP_Error
. - Fix an error with the trace not passing through.
- Fix
get_facade_accessor
signature.
- Fix a fatal error when the build directory doesn't exist.
- Remove Laravel Mix support. Switch to asset loader that aligns with shared company configuration.
- Ensure --url doesn't throw an error on bin/mantle
- Fix issue with custom namespace in application.
- Upgrading to
voku/portable-ascii
v2 to fix conflicted version withilluminate/support
.
- Improvements to database factories: adds
with_meta()
to all supported types, addswith_posts()
to term factory. - Upgrading to Symfony 6 and Illuminate/View 9
- Allow
Mantle\Testing\Mock_Http_Response
to be converted toMantle\Http_Client\Response
- Support streamed HTTP responses in the client and fake.
- Add
maybe_rsync_content
during testing. - Add
--delete
when rsyncing content during testing. - Work to make Mantle a bit more isolated.
- Fix for testing installation.
- Allow more flexible control over incorrect usage and deprecations
- Add support for rsync-ing a codebase from within the testing suite
- Fixes for WordPress 6.1
- Adding support for testing commands
- Add support for an isolated console mode
- Use the existing WP_CORE_DIR if one exists
- Display trace for incorrect usage/deprecation notices
- Authentication assertions and tests
- **Fix:*- Set default to string incase of missing location.
- Adding assertions for element missing/existing.
- Middleware for testing factories.
- Asset assertions and improvements.
- Support for mix pulling in dependencies.
- Cast the item to an array inside of only_children.
- Adding keywords to trigger --dev.
- Separate requires based on what they include.
- Compatibility layer for Refresh_Database and Installs_WordPress.
- Adding alleyinteractive/wp-filter-side-effects to mantle-framework/database
- Ensure tests have a permalink structure by default.
- Adding only_children() method to collections.
- Update to
alleyinteractive/composer-wordpress-autoloader
v1.0.0. - Overhaul queue system, add support for closures to be dispatched to the queue asynchronously.
- Remove Caper package in favor of https://github.com/alleyinteractive/wp-caper.
- Fixing issue with testing library
- Fixing issue with Http Client.
- Fixing issue with testing installation callback.
- Prevent external requests during unit testing in #293
- Adding macroable to responses in #292
- Bump actions/cache from 3.0.4 to 3.0.5 by @dependabot in #294
- Bumping asset manager in #295
- Update testkit to include URL Generator in #296
- Add request before/after callbacks in #298
- Cleaning up the flag/argument, simplify to flag/argument/option in #297
- Including mantle-framework/http-client with testing in #299
- Fix Asset_Manager bug on asset() by @anubisthejackle in #300
- Adding an Installation_Manager to facilitate installation in #302
- Adding Conditionable Method Chaining in #304
- Adding support for Mock_Http_Sequence inside an array in #303
- Adding Concurrent Http Client Request Support in #301
- Bumping composer autoloader to v0.6 in #306
Fixing a miss-tagged version.
- Allow testing framework factory to return models pull/276
- Define Post Model Terms Fluently
- Add is_json/headline to Str
- Adding a With_Faker trait
- Adding Assert JSON Structure
- Make all headers lowercase for easier comparison when testing
- Create new Testkit cases: Integration and Unit Test by @anubisthejackle in #269
- Adding create_ordered_set helper in #271
- Allow control over the temporary URL expiration in #272
- Allow attributes to register hooks in #273
- Registering listeners with attributes in #275
- Fix Faker deprecation warnings about accessing methods as parameters by @anubisthejackle in #270
- Ensure WP_MULTISITE can be passed properly in #274
0.1.0 - 2022-04-19
Initial release of the Mantle Framework 🎉