PHPackages                             anlutro/l4-testing - 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. anlutro/l4-testing

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

anlutro/l4-testing
==================

Base PHPUnit classes for Laravel 4.

0.2.9(8y ago)133.7k↓80%13MITPHPPHP &gt;=5.4.0

Since Jan 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/anlutro/laravel-testing)[ Packagist](https://packagist.org/packages/anlutro/l4-testing)[ RSS](/packages/anlutro-l4-testing/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (16)Used By (3)

Laravel 4 Test classes [![Build Status](https://camo.githubusercontent.com/472831725b35c907e20770229a16c55e8dfae5dc1bd15eab3182cd4cd6f92a4d/68747470733a2f2f7472617669732d63692e6f72672f616e6c7574726f2f6c61726176656c2d74657374696e672e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/anlutro/laravel-testing) [![Latest Version](https://camo.githubusercontent.com/ab570c1974d2ba91e9dda26d098fca996a2d87609f2ab28ae74a9c3cc4e5f958/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f616e6c7574726f2f6c61726176656c2d74657374696e672e737667)](https://github.com/anlutro/laravel-testing/releases)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#laravel-4-test-classes--)

Installation: `composer require anlutro/l4-testing`

Pick the latest stable version from packagist or the GitHub tag list.

### PkgAppTestCase

[](#pkgapptestcase)

If you're writing an extensive package with routes, views, event listeners, view composers etc., this one is for you. This test case basically takes the default laravel installation, lets you add your package's service providers on top, and then you have a fully functional test case just like you would in a regular Laravel application - except it's in a package.

```
class MyTest extends \anlutro\LaravelTesting\PkgAppTestCase { }

```

To make this test case work, you need to require the laravel/laravel package in your package's composer.json "require-dev". The test case has one abstract method, `getVendorPath`, which is what it sounds like.

The method `getExtraProviders` should return an array of strings containing the fully qualified class names of any service providers your package requires to function in addition to the default Laravel ones.

### EloquentTestCase

[](#eloquenttestcase)

Standalone test for testing Eloquent models.

```
class MyTest extends \anlutro\LaravelTesting\EloquentTestCase { }

```

Defaults to using an sqlite in-memory database, but you can configure this by overriding `getDatabaseConfig()`. The protected methods `getMigrations` and `getSeeders` can be used to have migrations and seeds run before each test. These methods should return an array of strings that are the fully qualified class names of said migrations and seeders. It is your responsibility to make sure that these are either autoloaded via composer or required manually in your tests.

You can set `protected $enableEvents` or `protected $enableCache` to true if you want to use events or the cache in your test.

If you need some additional stuff to be available to facades (the hasher, for example), you can add it manually to `$this->container`. For example, to make `Hash::make` available to the test environment, put the following in your `setUp` method:

```
parent::setUp();
$this->container->bindShared('hash', function() {
    return new \Illuminate\Hashing\BcryptHasher;
});

```

Keep in mind that while in a normal Laravel application, all facades are available in the global namespace. This is not the case in an isolated environment. Efforts have been made to make the most common Eloquent-related facades available globally, but some may not be. To solve this, simply look up the real name of the class in app/config/app.php under "aliases" and add a use statement at the top of your model class where you import this class.

### L4TestCase

[](#l4testcase)

Basically just an improvement on the default Laravel TestCase.

```
class MyTest extends \anlutro\LaravelTesting\L4TestCase { }

```

Set `protected $controller = 'MyController'` on your test class and you get access to some shorthands like `$this->getAction('show', [1])` which will expand into `$this->call('get', URL::action('MyController@show', [1]))`. This works similarily for `assertRedirectedToAction`.

`$this->assertRouteHasFilter()` can be used to assert that the previously called route has a certain filter. Note that this only works with filters defined in routes.php, not filters defined in controller constructors.

Contact
-------

[](#contact)

Open an issue on GitHub if you have any problems or suggestions.

License
-------

[](#license)

The contents of this repository is released under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~119 days

Recently: every ~348 days

Total

14

Last Release

2955d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48f62855097c02888b96494da9a389988cd7ecb9001465f8ec30f15672fb5b5a?d=identicon)[anlutro](/maintainers/anlutro)

---

Top Contributors

[![anlutro](https://avatars.githubusercontent.com/u/163093?v=4)](https://github.com/anlutro "anlutro (43 commits)")

### Embed Badge

![Health badge](/badges/anlutro-l4-testing/health.svg)

```
[![Health](https://phpackages.com/badges/anlutro-l4-testing/health.svg)](https://phpackages.com/packages/anlutro-l4-testing)
```

###  Alternatives

[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k15.5M904](/packages/phpro-grumphp)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[spatie/test-time

A small package to control the flow time

2084.7M119](/packages/spatie-test-time)[mayflower/php-codebrowser

A code browser that augments the code with information from various QA tools.

1352.2M61](/packages/mayflower-php-codebrowser)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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