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.
This release has significant breaking changes in it. Please ensure you have read over what has changed before upgrading.
- Added a
bin/asyncunit config:generate
command that will create a standardasync-unit.json
file in your project's root directory. - Introduce concept of a
MockBridge
that allows third-party mocking libraries to be integrated into a test suite. - Introduce a
JsonConfigurationFactory
implementation that takes over the previous functionality provided by theConfigurationFactory
. - Introduce a
ConfigurationValidator
implementation that will ensure an instantiatedConfiguration
is valid and tests can properly run. - Added an
AsyncUnitApplication::VERSION
constant for the current version of the application. - Introduced the concept of a test error distinctly separate from a test failure. If an unexpected exception is thrown by the test this will be properly marked as an error and not a failure.
- Added appropriate test error counts to all relevant Statistics models.
- Added a new
TestErroredEvent
that will be triggered when a test errors. - Added a
TestState::Errored
enum value.
- Renamed
TestFrameworkApplication
->AsyncUnitApplication
- Renamed
TestFameworkApplicationObjectGraph
->AsyncUnitApplicationObjectGraph
- Rename
DefaultResultPrinter
->TerminalResultPrinter
- Refactored the
ConfigurationFactory
into an interface with a single method to makeConfiguration
instances. - Moved the
AsyncUnitFrameworkRunner
out of the CLI tool and into the framework itself. This allows for easier testing and more control over how the framework is processed. This implementation is meant to act as a facade that only requires its dependencies and can run the desired tests while returning a simple boolean value for whether there were test failures. - The
AsyncUnitApplication
now requires aConfigurationFactory
andConfigurationValidator
as constructor dependencies. Additionally, instead of passing the test directories to scan a configuration file is passed and the directories are read from that configuration. - Ensure that
ResultPrinterPlugin
custom loading happens within the object graph and isn't something necessary to add later as additional boilerplate. - Updated the
TerminalResultPrinter
to account for test errors and to output appropriate progress indicators.
- Removed the
RunTestsFromConfgurationCommand
in the CLI app.
- Introduced the
amphp/file
library to handle async I/O on the filesystem. - Introduced a
StaticAnalysisParser
that uses PHP-Parser and makes significant improvements over the previous parser implementation. - Added the
labrador-kennel/styled-byte-stream
project to support formatted terminal output. - Adds the ability to expect that no assertions are expected to take place. If a test expects no assertions and an assertion is made it results in a failure. This method accounts for both
Assertion
andAsyncAssertion
types. - Adds a
Context\TestExpector
that represents the expectations, for example whether an exception is thrown or the amount of assertions to expect, that a test can make. - Adds a
#[Timeout]
Attribute that can be annotated on tests,TestCase
, orTestSuite
to cause a TestFailure if the test takes longer than the provided number of milliseconds. - Introduces a comprehensive statistics API that's accessible through the event system to gather information about the system both pre and post test processing.
- Breaking Change! Refactored the
Parser
implementation into an interface to support different types of parsers in the future. - Breaking Change! Updates the
Parser::parse
return type to be aPromise
and use async I/O. - Breaking Change! The
TestFrameworkApplication
now expects to get aParser
implementation and the directories to parse as a constructor dependency. TheTestFrameworkApplication
is now responsible for initiating parsing. - Breaking Change! Removes the
TestCase::expectException*
methods. ATestCase::expect()
now returns aTestExpector
- Updates the exception thrown during compilation if a class annotated with an AsyncUnit Attribute cannot be loaded to better inform the user what has happened.
- Fixes a bug where the inappropriate directory was used when executing the AsyncUnit executable from
vendor/bin
- Updates Labrador Core to 3.2.0
- Added a
#[Disabled]
Attribute that allows for annotating a test, TestCase, or TestSuite to not run. #63 - Adds the total time and memory usage to default test output. #64
- Ensures that any test that has output is marked as a failure. #67
- Randomize all tests so none of them process in any specific order. Depending on the order of the tests is a code smell in your application or testing suite. #68
- Adds
assert()->instanceOf
,assert()->isEmpty
, andassert()->countEquals
along with their asynchronous counterparts. #69 - Adds the ability to expect that an exception is thrown from your test. #70
- Adds a
TestResult::getState
method that returns an enum whether test passed, failed, or was disabled.
- Breaking Change! Renamed
TestInvokedEvent
->TestProcessedEvent
to better signify that the test might not have actually been invoked if it was disabled. - Breaking Change! Removes the
TestOutput
interface in favor of using theAmp\ByteStream\OutputStream
interface. - Breaking Change! Renamed
DefaultTestSuite
->ImplicitTestSuite
to not conflict with the attribute of the same name. - Breaking Change! Renamed
#[TestSuite]
->#[AttachToTestSuite]
to not conflict with the interface of the same name. - Breaking Change! Refactored the
HookModel
type to be an enum instead of a string.
- Breaking Change! Removed the
TestResult::isSuccessful
method. With the addition of a disabled boolean the state of the test became too complex to manage with booleans.
- Adds initial implementation of an explicit TestSuite. #50
- Invoke all existing hooks for an explicit TestSuite. Adds
#[BeforeEachTest]
and#[AfterEachTest]
hooks for the TestSuite to have access to invoking hooks around each test. #54 - Allow for a TestSuite and TestCases associated to it to read and write arbitrary state. #57
- Adds a
TestOutput
andResultPrinterPlugin
implementations to facilitate creating result output that's not tied to Symfony Console. #58 - Improved, reusable implementations of a new interface
AssertionMessage
that represents the results of an Assertion. #58 - Emit more complete events representing the complete lifecycle of the testing process. #59
- Breaking Change! Renamed the CLI namespace to
Cspray\Labrador\AsyncUnitCli
to more clearly separate it from the framework itself. - Breaking Change! Renames Event classes to no longer suffix
Event
at the end of the class name. - Breaking Change! Refactor
AssertionResult
to return implementations of new interfaceAssertionMessage
that represents the summary and details of the Assertion.
- Support running tests that are extended from parent test cases. #31
- Support running
assert()->not()
andasyncAssert()->not()
to run the opposite assertion. Works for built-in and custom assertions. #32 - Support making your own custom Assertion and running it with
assert()->customAssertion()
andasyncAssert()->customAssertion()
. #33 - Support for running the same
#[Test]
multiple times by using a#[DataProvider]
. #34
- Breaking Change! Changed the
Assertion::assert
andAsyncAssertion::assert
methods to no longer take any parameters. This change is required to better support custom Assertions. When interacting with a custom Assertion we don't know what's expected, actual, or a custom error message. Assertions are now expected to pass everything they need to perform their task into the constructor, including the actual value being asserted.
- Fixes a problem where hooks were erroneously being invoked though the hook does not belong to the TestCase.
- Parser to analyze PHP code for configured tests and hooks.
- TestSuiteRunner to execute the parsed tests and hooks
- A TestCase and Assertions API for writing tests
- A CLI tool to execute tests in 1 or more directories
- A Result printer that details what Tests failed and why