All Projects → ergebnis → data-provider

ergebnis / data-provider

Licence: MIT License
👓 Provides generic data providers for use with phpunit/phpunit.

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to data-provider

Phexecute
Phexecute - Awesome PHP Code Runner
Stars: ✭ 18 (+12.5%)
Mutual labels:  phpunit
php-finder refactoring-kata
🐘🔍Incomprehensible Finder Refactoring Kata port for PHP
Stars: ✭ 22 (+37.5%)
Mutual labels:  phpunit
phpunit-expect
BDD-style assertions for PHPUnit
Stars: ✭ 15 (-6.25%)
Mutual labels:  phpunit
annotate-pull-request-from-checkstyle
cs2pr - Annotate a GitHub Pull Request based on a Checkstyle XML-report within your GitHub Action
Stars: ✭ 146 (+812.5%)
Mutual labels:  phpunit
php-test-generator
Generate test cases for existing PHP files
Stars: ✭ 47 (+193.75%)
Mutual labels:  phpunit
phpunit-json-assertions
JSON assertions for PHPUnit (including JSON Schema)
Stars: ✭ 30 (+87.5%)
Mutual labels:  phpunit
asynit
🌠 Asynchronous HTTP Request Testing Library for API or more...
Stars: ✭ 74 (+362.5%)
Mutual labels:  phpunit
phpunit-documentation-english
English Documentation for PHPUnit
Stars: ✭ 55 (+243.75%)
Mutual labels:  phpunit
test-tools
Improves PHPUnit testing productivity by adding a service container and self-initializing fakes
Stars: ✭ 25 (+56.25%)
Mutual labels:  phpunit
php-mime-detector
Detect a file's mime type using magic numbers.
Stars: ✭ 20 (+25%)
Mutual labels:  phpunit
dusker
Stand alone Laravel Dusk test suit, which do not require Laravel framework itself
Stars: ✭ 28 (+75%)
Mutual labels:  phpunit
phpunit-extensions
Extensions for PHPUnit for Humbug
Stars: ✭ 17 (+6.25%)
Mutual labels:  phpunit
phpunit-travis-ci-coverage-example
phpUnit Testing on Travis-CI with Code Coverage on CodeCov
Stars: ✭ 30 (+87.5%)
Mutual labels:  phpunit
codeigniter-tettei-apps
『CodeIgniter徹底入門』のサンプルアプリケーション(CodeIgniter v3.1版)
Stars: ✭ 26 (+62.5%)
Mutual labels:  phpunit
talks
Slides, code examples, reference materials, etc. for all technical talks I've given.
Stars: ✭ 11 (-31.25%)
Mutual labels:  phpunit
tester-phpunit
tester runner for phpunit on atom editor
Stars: ✭ 34 (+112.5%)
Mutual labels:  phpunit
strict-phpunit
Enables type-safe comparisons of objects in PHPUnit.
Stars: ✭ 18 (+12.5%)
Mutual labels:  phpunit
helloslim3
A boilerplate for Slim Framework 3 apps
Stars: ✭ 36 (+125%)
Mutual labels:  phpunit
eloquent-phpunit
Eloquent model and database schema PHPUnit test case
Stars: ✭ 20 (+25%)
Mutual labels:  phpunit
wp-phpunit
WordPress core PHPUnit library. [READ ONLY] Versions for new WordPress releases are built daily.
Stars: ✭ 65 (+306.25%)
Mutual labels:  phpunit

data-provider

Integrate Prune Release Renew

Code Coverage Type Coverage

Latest Stable Version Total Downloads

Installation

Run

composer require --dev ergebnis/data-provider

Usage

This package provides the following generic data providers:

Since it is possible to use multiple @dataProvider annotations for test methods, these generic data providers allow for reuse and composition of data providers:

<?php

declare(strict_types=1);

namespace Example\Test;

use PHPUnit\Framework;

final class ExampleTest extends Framework\TestCase
{
    /**
     * @dataProvider \Ergebnis\DataProvider\StringProvider::blank()
     * @dataProvider \Ergebnis\DataProvider\StringProvider::empty()
     */
    public function testFromNameRejectsBlankOrEmptyStrings(string $value): void
    {
        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('Value can not be an empty or blank string.');

        UserName::fromString($value);
    }
}

DataProvider\BoolProvider

  • arbitrary() provides true, false
  • false() provides false
  • true() provides true

For examples, see Ergebnis\DataProvider\Test\Unit\BoolProviderTest.

DataProvider\FloatProvider

  • arbitrary() provides arbitrary floats
  • greaterThanOne() provides ints greater than 1.0
  • greaterThanZero() provides ints greater than 0.0
  • lessThanOne() provides ints less than 1.0
  • lessThanZero() provides ints less than 0.0
  • one() provides 1.0
  • zero() provides 0.0

For examples, see Ergebnis\DataProvider\Test\Unit\FloatProviderTest.

DataProvider\IntProvider

  • arbitrary() provides arbitrary ints
  • greaterThanOne() provides ints greater than 1
  • greaterThanZero() provides ints greater than 0
  • lessThanOne() provides ints less than 1
  • lessThanZero() provides ints less than 0
  • one() provides 1
  • zero() provides 0

For examples, see Ergebnis\DataProvider\Test\Unit\IntProviderTest.

DataProvider\NullProvider

  • null() provides null

For examples, see Ergebnis\DataProvider\Test\Unit\NullProviderTest.

DataProvider\ObjectProvider

  • object() provides an instance of stdClass

For examples, see Ergebnis\DataProvider\Test\Unit\ObjectProviderTest.

DataProvider\ResourceProvider

  • resource() provides a resource

For examples, see Ergebnis\DataProvider\Test\Unit\ResourceProviderTest.

DataProvider\StringProvider

  • arbitrary() provides arbitrary strings
  • blank() provides strings consisting of whitespace characters only
  • empty() provides an empty string
  • trimmed() provides non-empty, non-blank strings without leading and trailing whitespace
  • untrimmed() provides non-empty, non-blank strings with additional leading and trailing whitespace
  • uuid() provides lower- and upper-case UUID strings
  • withWhitespace() provides non-empty, non-blank, trimmed strings containing whitespace

For examples, see Ergebnis\DataProvider\Test\Unit\StringProviderTest.

Changelog

Please have a look at CHANGELOG.md.

Contributing

Please have a look at CONTRIBUTING.md.

Code of Conduct

Please have a look at CODE_OF_CONDUCT.md.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.

Curious what I am building?

📬 Subscribe to my list, and I will occasionally send you an email to let you know what I am working on.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].