Closed ke20 closed 10 years ago
I don't kown if atoumBundle works fine with SIlex (maybe you should open an issue on its repository to have an answer about this point), but i think that you have an autoloading problem. Use a bootstrap file to set the Silex autoloader. Moreover, i think that http://blog.eexit.net/2011/11/php-projet-silex-tdd-pour-le-code-metier.html can help you to set up atoum and Silex correctly.
Silex works fine, I use a bootstrap file for my Silex application and a little boostrap file for atoum (which contains just a call to the autoload file)
Thanks for the link, but I already saw it. The author use the atoum file phar and I use composer, the configuration is not same... :(
It's maybe the autoloading as you say, I've use this link http://blog.eexit.net/2012/06/php-utiliser-lautoloader-de-composer-avec-atoum.html.
I will continue to investigate and if I find a solution I'll post it
_EDIT_: I've forgotten to precise, I've no errors when I doesn't define the method testIndex() in the test class
All my apologize, i have made a mistake : the problem is not the autoload.
Have you overloaded the test namespace ?
By default, the namespace of test class should contains tests/units
, but in your case, it must be only Tests
.
See http://docs.atoum.org/fr/chapitre4.html#Changer-l-espace-de-nom-par-defaut for more informations.
Yes, but the class ControllerTest
of atoumBundle
is already overloaded by the namespace with the correct namespace to replace, and my test class extends the ControllerTest
.
namespace atoum\AtoumBundle\Test\Controller;
use atoum\AtoumBundle\Test\Units\WebTestCase;
use mageekguy\atoum;
abstract class ControllerTest extends WebTestCase
{
public function __construct(atoum\adapter $adapter = null, atoum\annotations\extractor $annotationExtractor = null, atoum\asserter\generator $asserterGenerator = null, atoum\test\assertion\manager $assertionManager = null, \closure $reflectionClassFactory = null)
{
parent::__construct($adapter, $annotationExtractor, $asserterGenerator, $assertionManager, $reflectionClassFactory);
$this->setTestNamespace('Tests');
}
}
It's very strange, because in the error message the two paths in error are correct....
Any feedback ?
Im really not sure, I might think about autoload issue too. Is it possible to have the bootstrap you used for atoum ? On Sep 20, 2013 12:07 PM, "Frédéric Hardy" notifications@github.com wrote:
Any feedback ?
— Reply to this email directly or view it on GitHubhttps://github.com/atoum/atoum/issues/222#issuecomment-24800792 .
I'm sorry I haven't seen your answers.
My Silex bootstrap file is like that:
<?php
use Symfony\Component\HttpFoundation\Response;
$loader = require_once __DIR__.'/../vendor/autoload.php';
$loader->add('App', dirname(__DIR__));
$app = new Silex\Application();
$app = require_once __DIR__.'/config.php';
$app = require_once __DIR__.'/routes.php';
// Manage the errors pages
$app->error(function (\Exception $e, $code) use ($app) {
if($app['debug'] === TRUE) {
return;
}
switch ($code) {
case 404:
$message = 'La page demandée n\'a pas été trouvée.';
break;
default:
$message = 'Oups, une erreur est survenue.';
}
return $app['twig']->render('error.html.twig', array(
'message' => $message
));
});
$app->boot();
$app->run();
return $app;
I was talking about the bootstrap used for atoum :) Still failing ?
Oh I'm sorry, but my bootstrap file is very tiny because there is three lines...
$loader = require_once __DIR__.'/../vendor/autoload.php';
$loader->add('App', dirname(__DIR__).'/../App/');
$loader->add('Tests', dirname(__DIR__));
Hi,
I'm using Silex in my project and I just installed atoum for create my unit tests. I've also installed atoum-bundle for to have the TestController classes and the WebTestCase.
When I execute atoum
bin\atoum -d Tests
, the console returnBut my class
App\Controllers\StaticPagesController
exists and my other classTests\App\Controllers\MyController
also.My project's structure looks like:
In my real classe have
and in my test class have
It's a bug or it's because atoum-bundle doesn't work with Silex?