PHPackages                             app-verk/api-test-cases - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. app-verk/api-test-cases

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

app-verk/api-test-cases
=======================

Test cases for boost up writing PHPUnit tests for API with Symfony 3 framework

1.0.9(4y ago)19394MITPHPPHP ^7.2CI failing

Since Jul 8Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/AppVerk/ApiTestCasesBundle)[ Packagist](https://packagist.org/packages/app-verk/api-test-cases)[ RSS](/packages/app-verk-api-test-cases/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (9)Versions (13)Used By (0)

ApiTestCasesBundle
==================

[](#apitestcasesbundle)

[![Build Status](https://camo.githubusercontent.com/a91d4e3ac3d37f3f4926475a4fd4df100605db5c8468ccb3f093d7a32458552d/68747470733a2f2f7472617669732d63692e6f72672f4170705665726b2f41706954657374436173657342756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/AppVerk/ApiTestCasesBundle)

Test cases for boost up writing PHPUnit functional tests for API with Symfony framework. Bundle is helping you debuging failed tests and bosting TDD process.

Examples failed response
------------------------

[](#examples-failed-response)

```
Failure! when making the following request:
POST: http://foo.app/app_test.php/api/security/token

HTTP/1.1 404 Not Found
Date: Sat, 08 Jul 2017 12:28:19 GMT
Server: Apache
X-Powered-By: PHP/7.0.15
Cache-Control: no-cache, private
Content-Length: 84
Content-Type: application/problem+json
{
    "detail": "Client is blocked",
    "status": 404,
    "type": "about:blank",
    "title": "Not Found"
}

"Client is blocked" does not match "Client is blockedx".
@@ -1,5 +1,5 @@
 {
-  "detail": "Client is blockedx",
+  "detail": "Client is blocked",
   "status": 404,
   "type": "about:blank",
   "title": "Not Found"

```

Usage
-----

[](#usage)

All you need to do is extend JsonApiTestCase in your functional controller class.

```
use AppVerk\ApiTestCasesBundle\Api\Cases\JsonApiTestCase;
use Symfony\Component\HttpFoundation\Response;

class ProfileControllerTest extends JsonApiTestCase
{
    ...
}

```

Testing API methods
-------------------

[](#testing-api-methods)

### Test code:

[](#test-code)

```
public function testMeActionSuccess()
{
    $this->authenticateFixtureUser('profile/user.yml');
    $response = $this->client->get('/api/profile/me');

    $this->assertResponse($response, 'profile/me/success', Response::HTTP_OK);
}

```

### Alice schema file:

[](#alice-schema-file)

```
AppBundle\Entity\User:
user1:
    username: test
    email: test@test.foo
    password: test

```

### JWT authentication method with lexik/LexikJWTAuthenticationBundle:

[](#jwt-authentication-method-with-lexiklexikjwtauthenticationbundle)

```
protected function authenticateFixtureUser(
    string $userFixturePath,
    $expired = JwtTokenFactory::EXPIRATION_TIME
) {
    $this->loadFixturesFromFile($userFixturePath);

    $tokenData = [
        'username' => 'test',
        'exp'      => time() + $expired,
    ];

    $token = $this->getService('lexik_jwt_authentication.encoder')->encode($tokenData);

    self::$staticClient->setDefaultOption('headers/Authorization', 'Bearer '.$token);

    return $tokenData;
}

```

### config file - config\_test.ynl

[](#config-file---config_testynl)

```
security:
encoders:
    AppBundle\Entity\User: plaintext

```

More examples
-------------

[](#more-examples)

for more examples please visit

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance54

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~169 days

Recently: every ~212 days

Total

10

Last Release

1745d ago

PHP version history (2 changes)v1.0PHP ^7.0

1.0.3PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf6cb56059f54c393f46d2f0dd1c2da6a5781cb795c5e3bdcd885e720a1b31e3?d=identicon)[hbernaciak](/maintainers/hbernaciak)

![](https://www.gravatar.com/avatar/ae3d6238b46a202f09c6af6c8a7129cc1d0c652ea859160d8bee48a2a99eaa80?d=identicon)[art4webs](/maintainers/art4webs)

---

Top Contributors

[![michaljedraszczyk](https://avatars.githubusercontent.com/u/884463?v=4)](https://github.com/michaljedraszczyk "michaljedraszczyk (8 commits)")[![tymo49](https://avatars.githubusercontent.com/u/22803683?v=4)](https://github.com/tymo49 "tymo49 (5 commits)")[![tymo49a](https://avatars.githubusercontent.com/u/178318203?v=4)](https://github.com/tymo49a "tymo49a (4 commits)")[![hbernaciak](https://avatars.githubusercontent.com/u/16296702?v=4)](https://github.com/hbernaciak "hbernaciak (2 commits)")[![mkurc1](https://avatars.githubusercontent.com/u/2181797?v=4)](https://github.com/mkurc1 "mkurc1 (1 commits)")[![naros1988](https://avatars.githubusercontent.com/u/7100387?v=4)](https://github.com/naros1988 "naros1988 (1 commits)")

---

Tags

phpunitTest Casesapi cases

### Embed Badge

![Health badge](/badges/app-verk-api-test-cases/health.svg)

```
[![Health](https://phpackages.com/badges/app-verk-api-test-cases/health.svg)](https://phpackages.com/packages/app-verk-api-test-cases)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k129.9M910](/packages/brianium-paratest)[lchrusciel/api-test-case

Perfect PHPUnit TestCase for JSON/XML API TDD with Symfony.

4125.8M68](/packages/lchrusciel-api-test-case)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
