PHPackages                             shortcodes/tests - 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. shortcodes/tests

ActivePackage[Testing &amp; Quality](/categories/testing)

shortcodes/tests
================

This is test package for Laravel Application

0.0.5(5y ago)02.7k[2 PRs](https://github.com/shortcodes/tests/pulls)mitPHPPHP &gt;=7.0.0

Since Nov 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/shortcodes/tests)[ Packagist](https://packagist.org/packages/shortcodes/tests)[ RSS](/packages/shortcodes-tests/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)DependenciesVersions (11)Used By (0)

Test tools for laravel application 2
====================================

[](#test-tools-for-laravel-application-2)

This is package of test tools to help test laravel app properly

Tools
=====

[](#tools)

#### Api CRUD testing

[](#api-crud-testing)

To test CRUD in your API you need to create test that extends `Shortcodes\Tests\Blueprints\ApiCrudTest` and provide model class in protected property

```
class ModelCrudTest extends ApiCrudTest
{
    protected $model = Model::class;
}

```

By default test will perform assertions to test

- i\_can\_make\_index\_request\_and\_get\_200\_status
- i\_can\_make\_show\_request\_and\_get\_200\_status
- i\_can\_make\_store\_request\_and\_get\_201\_status
- i\_can\_make\_update\_request\_and\_get\_200\_status
- i\_can\_make\_delete\_request\_and\_get\_204\_status

It is crucial to remember that provided `model` must have factory with valid generated data.

If `index` method requires some query string parameters you can define it in class method

```
class ModelCrudTest extends ApiCrudTest
{
    protected $model = Model::class;

    public function getQueryStringParams(){
        return [
            'length' => 10,
            'page' => 1
        ];
    }
}

```

#### Form Request testing

[](#form-request-testing)

To test Form Request in your API you need to create test that extends `Shortcodes\Tests\Blueprints\FormRequestTest` and provide request class in protected property

```
class IndexModelRequestTest extends FormRequestTest
{
    protected $model = IndexModelRequest::class;
}

```

`FormRequestTest` class allow to use method to validate request like in the example

```
class IndexModelRequestTest extends FormRequestTest
{
    protected $model = IndexModelRequest::class;

    public function testValidRequest(){
        $this->prepareRequest(['some_data'=>'value'])->assertValidRequest()
    }

    public function testInvalidRequest(){
        $this->prepareRequest(['some_data'=>'value'])->assertInvalidRequest()
    }

    public function testInvalidParameterInRequest(){
        $this->prepareRequest(['some_data'=>'value','invalid_parameter'=>'value'])
            ->assertInvalidRequest()
            ->assertInvalidParameter(['invalid_parameter'])
            ->assertInvalidParameter('invalid_parameter')   //or without array
            ->assertInvalidParameter('missing_request_required_parameter')
    }

    public function testValidParameterInInvalidRequestRequest(){
        $this->prepareRequest(['some_data'=>'value','invalid_parameter'=>'value'])
            ->assertInvalidRequest()
            ->assertInvalidParameter(['invalid_parameter'])
            ->assertValidParameter(['some_data'])
    }
}

```

There is also possibility to test request whit required injected model like with query parameters.

```
class IndexModelRequestTest extends FormRequestTest
{
    protected $model = UpdateModelRequest::class;

    public function testTitleDuplicationRequest(){
        $object = Model::first();
        $this->prepareRequest(['title'=>$object->title'], $object)->assertValidRequest()
    }
}

```

#### Api request testing

[](#api-request-testing)

To test Api Request in you need to create test that extends `Shortcodes\Tests\Blueprints\TestCase`. This is a simple wrapper on standard method that allows to write less code.

```
$response = $this->apiRequest('POST', url('named.route.name'), $data, $headers);

```

Method create request that act as user defined in class `user` property or create one from factory. And attach header for authorization `X-App-Token` which is taken from `env('AUTH_KEY')`,

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

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 ~108 days

Total

5

Last Release

1942d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30219536?v=4)[Roman Szymański](/maintainers/shortcodes)[@shortcodes](https://github.com/shortcodes)

---

Top Contributors

[![shortcodes](https://avatars.githubusercontent.com/u/30219536?v=4)](https://github.com/shortcodes "shortcodes (4 commits)")[![ttryka-mindz](https://avatars.githubusercontent.com/u/275661947?v=4)](https://github.com/ttryka-mindz "ttryka-mindz (2 commits)")

### Embed Badge

![Health badge](/badges/shortcodes-tests/health.svg)

```
[![Health](https://phpackages.com/badges/shortcodes-tests/health.svg)](https://phpackages.com/packages/shortcodes-tests)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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