Download the PHP package codekandis/phpunit without Composer
On this page you can find all versions of the php package codekandis/phpunit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codekandis/phpunit
More information about codekandis/phpunit
Files in codekandis/phpunit
Package phpunit
Short Description `codekandis/phpunit` is a library for `PHPUnit` testing with enhanced test cases and custom constraint assertions.
License MIT
Informations about the package phpunit
codekandis/phpunit
codekandis/phpunit is a library for PHPUnit testing with enhanced test cases and
custom constraint assertions.
Index
- Installation
- Usage
- Using the test case wrapper
- Failing exception test branches
TestCase::failUnexpectedThrowableHasBeenThrown()TestCase::failExpectedThrowableHasNotBeenThrown()- Using the data provider interface
- Asserting array subsets
TestCase::assertArrayContainsKeyedSubset()TestCase::assertArrayContainsUnkeyedSubset()TestCase::assertIsKeyedSubsetOfArray()TestCase::assertIsUnkeyedSubsetOfArray()- Asserting subclass relationships
TestCase::assertIsSubClassOf()
Installation
Install the latest version with
Usage
Using the test case wrapper
Create a test case that extends the TestCase wrapper.
The additional constraint assertions are available through this wrapper.
Failing exception test branches
Use the protected fail helpers in test cases that assert exception control flow explicitly.
TestCase::failUnexpectedThrowableHasBeenThrown()
Use
TestCase::failUnexpectedThrowableHasBeenThrown() to fail
a test when a throwable has been thrown in a branch that must not throw.
TestCase::failExpectedThrowableHasNotBeenThrown()
Use TestCase::failExpectedThrowableHasNotBeenThrown()
to fail a test when an expected throwable has not been thrown.
Using the data provider interface
Create a data provider that implements DataProviderInterface.
Use the data provider in your test case through
DataProviderInterface::PROVIDER_METHOD_NAME.
Asserting array subsets
TestCase::assertArrayContainsKeyedSubset()
Use TestCase::assertArrayContainsKeyedSubset() to assert that
$actualArray contains $expectedSubset with matching keys and values. Set $strict to true to compare values
strictly, or to false to compare values loosely.
TestCase::assertArrayContainsUnkeyedSubset()
Use TestCase::assertArrayContainsUnkeyedSubset() to assert
that $actualArray contains the values of $expectedSubset without comparing keys. Set $strict to true to compare
values strictly, or to false to compare values loosely.
TestCase::assertIsKeyedSubsetOfArray()
Use TestCase::assertIsKeyedSubsetOfArray() to assert that
$actualSubset is contained in $expectedArray with matching keys and values. Set $strict to true to compare
values strictly, or to false to compare values loosely.
TestCase::assertIsUnkeyedSubsetOfArray()
Use TestCase::assertIsUnkeyedSubsetOfArray() to assert that the
values of $actualSubset are contained in $expectedArray without comparing keys. Set $strict to true to compare
values strictly, or to false to compare values loosely.
Asserting subclass relationships
TestCase::assertIsSubClassOf()
Use TestCase::assertIsSubClassOf() to assert that $actual is a subclass of
or implements $expectedInterfaceOrClassFqcn. $actual can be an object or an FQCN.
The assertion throws an
UnknownClassOrInterfaceException if the expected type does not
exist.