mirror of
https://github.com/moparisthebest/wallabag
synced 2024-12-18 05:32:23 -05:00
Trying to test a dummy Entry class
It seems that Atoum doesn't find the class to be tested when running `./console tests:unit` ==> Error E_USER_ERROR in /home/vjousse/usr/src/php/poche/tests/unit/Entry.php on unknown line, generated by unknown file: Tested class 'Entry' does not exist for test class 'tests\unit\Entry'
This commit is contained in:
parent
9bfeaf9cc0
commit
f502810f43
@ -7,6 +7,6 @@
|
||||
"knplabs/console-service-provider": "dev-master"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Poche": "src/" }
|
||||
"psr-0": { "Poche\\": "src/" }
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,9 @@ class UnitTestsCommand extends BaseCommand
|
||||
{
|
||||
$atoum = $this->getProjectDirectory().'/vendor/bin/atoum';
|
||||
$unitTests = $this->getProjectDirectory().'/tests';
|
||||
$bootstrapFile = $this->getProjectDirectory().'/tests/bootstrap.php';
|
||||
|
||||
passthru(sprintf('%s -d %s -ft', $atoum, $unitTests), $status);
|
||||
passthru(sprintf('%s -d %s -bf %s -ft', $atoum, $unitTests, $bootstrapFile), $status);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
16
src/Poche/Model/Entry.php
Normal file
16
src/Poche/Model/Entry.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Poche\Model;
|
||||
|
||||
class Entry
|
||||
{
|
||||
public function __construct($id, $title) {
|
||||
$this->id = $id;
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
<?php
|
||||
use Poche\Model\Entry;
|
||||
|
||||
$app->get('/', function () use ($app) {
|
||||
return $app['twig']->render('index.twig');
|
||||
|
||||
$entry = new Entry(1, "Titre de test");
|
||||
|
||||
return $app['twig']->render('index.twig', array('entry' => $entry));
|
||||
});
|
||||
|
@ -1 +1,2 @@
|
||||
Poche v2
|
||||
Poche v2<br/>
|
||||
{{ entry.id }} - {{ entry.title }}
|
||||
|
18
tests/unit/Entry.php
Normal file
18
tests/unit/Entry.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace tests\unit;
|
||||
|
||||
use \atoum;
|
||||
|
||||
class Entry extends atoum
|
||||
{
|
||||
public function testGetId()
|
||||
{
|
||||
$entry = new Poche\Model\Entry();
|
||||
|
||||
$this
|
||||
->integer($entry->getId())
|
||||
->isEqualTo('Test')
|
||||
;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user