dimanche 11 juin 2017

Silex: How and why to use testing

The documentation on testing is not really clear to me. It says you can use testing to check whether my pages and my system works correctly.

In my opinion, that would mean it could check whether all rights are used properly or something like that. But I don't understand why I'd put so much time in coding the testing part.

I hope someon could explain and convince me why I should use testing, and as a second part: HOW I should use it!

So, as an example, this could be my basic index.php file:

<?php

require_once __DIR__.'/../vendor/autoload.php';

$app = new Silex\Application();
$app['debug'] = true;

$routes = $app['controllers_factory'];

$routes->match('/', function () use ($app) {
    return 'Hello';
});

$app->mount('/', $routes);
$app->run();

Could you give me an example or adjust my route and give some testing with it. And please don't use the examples from the documentation: they don't make sense to me and that's the whole reason why I'm asking it here.

Aucun commentaire:

Enregistrer un commentaire