danwe / dataproviders-differenttypesvalues
PhpUnit compatible data provider providing one value of each of PHP's built-in types per test case. Allows to exclude types based on the name of the test using the data provider.
Installs: 70
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/danwe/dataproviders-differenttypesvalues
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.6.*
This package is not auto-updated.
Last update: 2025-09-27 23:15:46 UTC
README
PhpUnit compatible data provider providing one value of each of PHP's built-in types per test case. Allows to exclude types based on the name of the test using the data provider.
Usage
Consider the following example:
<?php class PersonTest extends \PHPUnit_Framework_TestCase { /** * @expectedException InvalidArgumentException * * @dataProvider Danwe\DataProviders\DifferentTypesValues::oneOfEachTypeProvider */ public function testConstructionWithNonStringValues( $personName ) { new Person( $personName ); } // ... // further "Person" tests // ... }
Due to the test's WithNonStringValues
suffix, DifferentTypesValues::oneOfEachTypeProvider
will
only provide non-string values.
TODOs
- Excluding more than one type with a
WithNon<TYPE1>And<TYPE2>Values
test name suffix. With<TYPE1>And<TYPE2>Values
test name suffix to only provide values of the mentioned types.DifferentTypesValues::valuesProvider
to provide multiple different values for each type.