Download the PHP package hotel-quickly/nette-phpunit without Composer

On this page you can find all versions of the php package hotel-quickly/nette-phpunit. 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 nette-phpunit

Nette PHPUnit Build Status

Getting started

Installation

Run the following commands to install this package

Usage

In order to use Database test case, you must extend your base class from HQ\Test\AbstractDbTestCase and implement these 3 methods

  1. getContainer - This method will return Nette\Di\Container instance.
  2. getConnections - Return an array of HQ\Test\Connection\AbstractConnection(connectionName, baseSchema, ...) connections object.
    • connectionName - A database connection name, which will be used as a prefix of fixture file.
    • baseSchema - Database schema which includes CREATE TABLE ... sql statements.
  3. getBaseFixtureDir - Return a base directory for searching base fixture file (see

Working with fixtures

Loading fixtures

By default, fixtures will be automatically loaded from 3 places, in the following orders

  1. base fixtures
  2. class fixtures
  3. instance fixtures
1. base fixtures

This is a primary fixtures that will be loaded for all test cases (think of it as initial data for the whole apps)

2. class fixtures

This will be loaded each time test case was invoked.

3. instance fixtures

This is pretty much the same as class fixtures, except that we define the fixture inside TestCase itself (so only php array is supported.

Fixture formats + structure

This library currently supports 3 fixture formats e.g. json, yaml and php. All formats has the same fixture structure i.e.

json example

yaml example

php example - NOTE - Don't forget to put return statement

Improving testing speed

Due to the overhead of creating database schema at the beginning of the tests (only once). This might slow down your test suites speed. You can avoid this problem by exporting UNITTEST_CREATE_SCHEMA=false env and then run unit test as usual. This will make it skips database schema create overhead.

Common problems

This error indicates that your fixtures for same dataset (table e.g. user) has different column structure. For example, you have default-fixtures.yaml that contains user table and it has the following fields

But somewhere in other fixtures, you have same user table with different fields e.g.

This will cause the above error. To fix this, just make sure you define the same fields on each fixtures.

This happens when Nette has php ini zlib.output_compression enabled in the container. Removing this config during testing will fix this error


All versions of nette-phpunit with dependencies

PHP Build Version
Package Version
Requires phpunit/phpunit Version ^5.1
phpunit/dbunit Version ^2.0
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 hotel-quickly/nette-phpunit contains the following files

Loading the files please wait ....