draw / tester
Library base on phpunit to test your data with a fluent interface.
Installs: 28 944
Dependents: 16
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- ext-simplexml: *
- draw/core: ^0.9.78
- guzzlehttp/psr7: ^1.8 || ^2.0
- phpunit/phpunit: ^8.0 || ^9.0
- psr/http-message: ^1.0
- symfony/property-access: ^5.4.3
Requires (Dev)
- doctrine/orm: ^2.11
- nesbot/carbon: ^2.0
- pdeans/http: ^1.1
- symfony/console: ^5.4.3
- symfony/dependency-injection: ^5.4.3
Suggests
- pdeans/http: If you wan to use the curl http client
- symfony/cache: If you want to use the orm setup tool
- symfony/dependency-injection: If you want to test extension/configuration
- dev-master / 0.10.x-dev
- 0.9.78
- 0.9.77
- 0.9.76
- 0.9.75
- 0.9.74
- 0.9.73
- 0.9.72
- 0.9.71
- 0.9.70
- 0.9.69
- 0.9.68
- 0.9.67
- 0.9.66
- 0.9.65
- 0.9.64
- 0.9.63
- 0.9.62
- 0.9.61
- 0.9.60
- 0.9.59
- 0.9.58
- 0.9.57
- 0.9.56
- 0.9.55
- 0.9.54
- 0.9.53
- 0.9.52
- 0.9.51
- 0.9.50
- 0.9.49
- 0.9.48
- 0.9.47
- 0.9.46
- 0.9.45
- 0.9.44
- 0.9.43
- 0.9.42
- 0.9.41
- 0.9.40
- 0.9.39
- 0.9.38
- 0.9.37
- 0.9.36
- 0.9.35
- 0.9.34
- 0.9.33
- 0.9.32
- 0.9.31
- 0.9.30
- 0.9.29
- 0.9.28
- 0.9.27
- 0.9.26
- 0.9.25
- 0.9.24
- 0.9.23
- 0.9.22
- 0.9.21
- 0.9.20
- 0.9.19
- 0.9.18
- 0.9.17
- 0.9.16
- 0.9.15
- 0.9.14
- 0.9.13
- 0.9.12
- 0.9.11
- 0.9.10
- 0.9.9
- 0.9.8
- 0.9.7
- 0.9.6
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.9
- 0.8.8
- 0.8.7
- 0.8.6
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.59
- 0.7.58
- 0.7.57
- 0.7.56
- 0.7.54
- 0.7.53
- v0.7.52
- v0.7.51
- v0.7.50
- v0.7.49
- v0.7.48
- v0.7.47
- v0.7.46
- v0.7.45
- v0.7.44
- v0.7.43
- v0.7.42
- v0.7.41
- v0.7.40
- v0.7.39
- v0.7.38
- v0.7.37
- v0.7.36
- v0.7.35
- v0.7.34
- v0.7.33
- v0.7.32
- v0.7.31
- v0.7.30
- v0.7.29
- v0.7.28
- v0.7.27
- v0.7.26
- v0.7.25
- v0.7.24
- v0.7.23
- v0.7.22
- 0.7.21
- v0.7.20
- v0.7.19
- v0.7.18
- v0.7.17
- v0.7.16
- v0.7.15
- v0.7.14
- v0.7.13
- v0.7.12
- v0.7.11
- v0.7.10
- v0.7.9
- v0.7.8
- v0.7.7
- v0.7.6
- v0.7.5
- v0.7.4
- v0.7.3
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.23
- 0.5.22
- v0.5.21
- v0.5.20
- v0.5.19
- v0.5.18
- v0.5.17
- v0.5.16
- v0.5.15
- v0.5.14
- v0.5.13
- v0.5.12
- v0.5.11
- v0.5.10
- v0.5.9
- v0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- dev-packages-git-actions
This package is auto-updated.
Last update: 2023-09-30 13:43:20 UTC
README
Php Data Tester
Need to be updated
This library is a wrapper around PHPUnit Assert class to be able to use a fluent interface on the data you want to test.
The library can be install via Composer/Packagist.
Here is a quick example of how to use it in a PHPUnit TestCase:
<?php namespace Your\Project\Name; use PHPUnit\Framework\TestCase; use Draw\DataTester\Tester; class SimpleTest extends TestCase { public function test() { $data = [ 'key1' => 'value1', 'key2' => (object)['toto' => 'value'] ]; $tester = new Tester($data); $tester->assertInternalType('array') ->assertCount(2) ->path('[key1]')->assertSame('value1'); $tester->path('[key2].toto')->assertSame('value'); }
There is a lot more features available, just Read the Docs!
Php Http Tester
This library is meant to be a testing framework for http call. It is framework agnostic. By default it does a curl call to the specified url but you can use/create a adapter for the framework you are using.
The library can be install via Composer/Packagist.
In that example we are trying to have a browser flow so the usage of phpunit annotation @depends and @test make it more readable.
Here is a quick example of how to use it in a PHPUnit TestCase:
<?php namespace Your\Project\Name; use PHPUnit\Framework\TestCase; use Draw\HttpTester\HttpTesterTrait; class SimpleTest extends TestCase { use HttpTesterTrait /** * @test */ public function notAuthorizeProfileAccess() { static::$client->get('http://your.domain.com/api/me') ->assertStatus(403); } /** * @test * @depends notAuthorizeProfileAccess */ public function login() { $testResponse = static::$client->post( 'http://your.domain.com/api/tokens', json_encode([ 'username' => 'my-username', 'password' => 'my-password' ]) ); $content = $testResponse ->assertSuccessful() ->assertCookie('session') // We are not debating the usage of cookie here ;) ->getResponseBodyContents(); // Continue with the test of you content $this->assertJson($content); } /** * @test * @depends login */ public function getMyProfile() { // The same client is during all test. Cookies are sent automatically between request $testResponse = static::$client->get('http://your.domain.com/api/me') $content = $testResponse ->assertSuccessful() ->getResponseBodyContents(); // Continue with the test of you content $this->assertJson($content); } }
If you need to use it in another context and can still relay on PHPUnit Assertion you can simply create your the client manually and use it:
<?php use Draw\HttpTester\Client; $client = new Client(); $client->post( 'http://your.domain.com/api/tokens', json_encode([ 'username' => 'my-username', 'password' => 'my-password' ]) );
By default the client will use the DrawHttpTesterCurlRequestExecutioner but you can make your own by implementing the DrawHttpTesterRequestExecutionerInterface.
## Currently Supported Request Executioner
Curl DrawHttpTesterCurlRequestExecutioner draw/http-tester Laravel 4.2 DrawHttpTesterBridgeLaravel4Laravel4RequestExecutioner draw/http-tester
** Not available yet ** There is a lot more features available, just Read the Docs!