Download the PHP package visithor/visithor-bundle without Composer

On this page you can find all versions of the php package visithor/visithor-bundle. 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 visithor-bundle

Visithor Bundle for Symfony

Build Status Scrutinizer Code Quality Latest Stable Version Latest Unstable Version

Symfony Bundle for PHP Package visithor, a library that provides you a simple and painless way of testing your application routes with specific HTTP Codes.

Please read Visithor documentation in order to understand the final purpose of this project and how you should create your config files.

Installation

All you need to do is add this package in your composer under require-dev block and you will be able to test your application.

Then you have to update your dependencies.

Integration

This Bundle integrates the project in your Symfony project. This means that adds all the commands in your project console, so when you do app/console you will see the visithor:* commands.

Config

This Bundle provides you some extra features when defining your urls. Now you can define your routes using the route name and an array of parameters.

Environment

Maybe you need to prepare your environment before Visithor tests your routes, right? Prepare your database, load your fixtures, and whatever you need to make your test installation works.

By default, VisithorBundle has a simple implementation already working. This implementation takes care about building the database and creating your schema.

It takes care as well of the destruction of your testing database once your test is finished.

If you want to extend this behavior, for example for some fixtures load, then you need to do your own implementation, or extend this one.

To implement your own, you should define a service called visitor.environment_builder than implements the interface Visithor\Bundle\Environment\Interfaces\EnvironmentBuilderInterface.

If you take a look at this interface, you will se that you need to define two methods. The first one is intended to setUp your environment and will be called just once at the beginning of the suite. The second one will tear down such environment (for example removing database).

This is the way you can overwrite completely the default implementation, but if you just want to extend it, then is much simpler. Take a look at this example.

To call some commands you can use the protected method called executeCommand, but remember to call the parent method in order to initialize the application and call the already existing code.

Roles

You will, for sure, have the need to test your private routes. Of course, this is a common need and this bundle satisfies it :)

Let's check our simple security file.

Then, let's see our Visithor configuration.

In this case, all routes are under the default firewall, called default.

Route admin_route is protected by the access role ROLE_ADMIN, and because we are testing against this role, then we'll receive a 200.

Route superadmin_route is protected by the access role ROLE_SUPERADMIN, but in this case we are testing again using role ROLE_ADMIN, so we'll receive a 403 code.

Of course, you can define your firewall as a global option. Your routes will apply security only if both role and firewall options are defined.

Because you need to authenticate a real user in order to make it work, in your own EnvironmentBuilder implementation you will be able to return this user. Make sure that your testing environment is prepared to be tested.

Let's see a real example about an implementation of this method.

As you can see, the parameter received is the role you are intended to test, so you can switch between users depending on that value.


All versions of visithor-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^5.4|^7.0
symfony/config Version ^2.7|^3.0
symfony/dependency-injection Version ^2.7|^3.0
symfony/console Version ^2.7|^3.0
symfony/routing Version ^2.7|^3.0
symfony/http-foundation Version ^2.7|^3.0
symfony/security Version ^2.7|^3.0
symfony/framework-bundle Version ^2.7|^3.0
visithor/visithor Version ^0.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 visithor/visithor-bundle contains the following files

Loading the files please wait ....