Download the PHP package anlutro/l4-testing without Composer

On this page you can find all versions of the php package anlutro/l4-testing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package l4-testing

Laravel 4 Test classes Build Status Latest Version

Installation: composer require anlutro/l4-testing

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

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

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

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

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

License

The contents of this repository is released under the MIT license.


All versions of l4-testing with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
nesbot/carbon Version ~1.3
monolog/monolog Version ~1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anlutro/l4-testing contains the following files

Loading the files please wait ....