Download the PHP package cds-uwb/nette-presenter-tests without Composer

On this page you can find all versions of the php package cds-uwb/nette-presenter-tests. 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-presenter-tests

Nette Presenter Tests

Tests

Library based on PHPUnit framework to test Nette presenters via simple API.

The main functionality of Nette presenters is in their actions invoked by requests. The library allows to simply invoke presenter actions like as called from browser. Another functionality is handling form submission that can be also tested.

The easiest way to use the library is to extend Cds\NettePresenterTests\PresenterTestCase which provides all traits and also contains abstract method configureContainer that must be implemented to provide DI container for presenter creation.

Example of test class that extends PresenterTestCase:

If you don't want to extend Cds\NettePresenterTests\PresenterTestCase, you can use the traits directly. When using traits only you must create the DI container yourself and expose it as a protected Container $container property because PresenterCreate uses $this->container to instantiate presenters.

Available traits

Presenter mapping

The library require mapping from presenter class to presenter name which is used in request. In normal application the name is built by router and then passed to presenter factory which create presenter instance. The library works directly on presenter instance, so it needs to convert presenter class to presenter name which is then passed to presenter request. Default implementation uses some predefined rules to convert class to name but if something else is needed, own implementation of buildNameFromPresenter can be implemented to provide required mapping.

It's also possible to use Nette's presenter factory to provide class to name mapping but unformatPresenterClass is marked as internal and deprecated. Alternatively nepada/presenter-mapping can be used which provides this method (for now).

More examples

File upload testing

The library also allows test file uploading as part of form submission. The definition of file upload is specified as part of form data only using $this->uploadFile method that specifies file name, and it's content. It's also possible to specify upload result code (PHP's UPLOAD_ERR_* constants).

Testing without presenter property

It's possible test multiple different presenters without presenter property. Testing is done by PresenterRequest trait and its function runPresenter that allow to pass any presenter as argument.


All versions of nette-presenter-tests with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
latte/latte Version ^3.1
nette/application Version ^3.2
nette/bootstrap Version ^3.2
nette/di Version ^3.2
nette/forms Version ^3.2
nette/security Version ^3.2
nette/utils Version ^4.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 cds-uwb/nette-presenter-tests contains the following files

Loading the files please wait ...