Upgrade tests

This commit is contained in:
Romain Neutron
2012-07-27 18:30:18 +02:00
parent 3b74513837
commit 26aca64645
7 changed files with 29 additions and 31 deletions

View File

@@ -2,6 +2,8 @@
namespace Alchemy\Phrasea\Command;
use Alchemy\Phrasea\Application;
class UpgradeDBDatasTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -35,10 +37,8 @@ class UpgradeDBDatasTest extends \PHPUnit_Framework_TestCase
$this->object->setUpgrades(array());
$this->assertEquals(array(), $this->object->getUpgrades());
$core = \bootstrap::getCore();
$upgrades = array(
new Upgrade\Step31($core, $core['monolog'])
new Upgrade\Step31(new Application())
);
$this->object->setUpgrades($upgrades);
$this->assertEquals($upgrades, $this->object->getUpgrades());
@@ -51,14 +51,12 @@ class UpgradeDBDatasTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals(array(), $this->object->getUpgrades());
$core = \bootstrap::getCore();
$step31 = new Upgrade\Step31($core, $core['monolog']);
$step31 = new Upgrade\Step31(new Application());
$this->object->addUpgrade($step31);
$this->assertEquals(array($step31), $this->object->getUpgrades());
$step35 = new Upgrade\Step35($core, $core['monolog']);
$step35 = new Upgrade\Step35(new Application());
$this->object->addUpgrade($step35);
$this->assertEquals(array($step31, $step35), $this->object->getUpgrades());

View File

@@ -2,8 +2,8 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\CLI;
use Symfony\Component\Console\Tester\CommandTester;
use \Symfony\Component\Console\Application;
class module_console_aboutAuthorsTest extends PHPUnit_Framework_TestCase
{
@@ -18,10 +18,10 @@ class module_console_aboutAuthorsTest extends PHPUnit_Framework_TestCase
public function testExecute()
{
// mock the Kernel or create one depending on your needs
$application = new Application();
$application->add(new module_console_aboutAuthors('about:authors'));
$application = new CLI('test');
$application->command(new module_console_aboutAuthors('about:authors'));
$command = $application->find('about:authors');
$command = $application['console']->find('about:authors');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()));

View File

@@ -2,8 +2,8 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\CLI;
use Symfony\Component\Console\Tester\CommandTester;
use \Symfony\Component\Console\Application;
class module_console_aboutLicenseTest extends PHPUnit_Framework_TestCase
{
@@ -18,10 +18,10 @@ class module_console_aboutLicenseTest extends PHPUnit_Framework_TestCase
public function testExecute()
{
// mock the Kernel or create one depending on your needs
$application = new Application();
$application->add(new module_console_aboutLicense('about:license'));
$application = new CLI('test');
$application->command(new module_console_aboutLicense('about:license'));
$command = $application->find('about:license');
$command = $application['console']->find('about:license');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()));

View File

@@ -2,8 +2,8 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\CLI;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Application;
class module_console_schedulerStateTest extends PHPUnit_Framework_TestCase
{
@@ -14,10 +14,10 @@ class module_console_schedulerStateTest extends PHPUnit_Framework_TestCase
public function testExecute()
{
// mock the Kernel or create one depending on your needs
$application = new Application();
$application->add(new module_console_schedulerState('system:schedulerState'));
$application = new CLI('test');
$application->command(new module_console_schedulerState('system:schedulerState'));
$command = $application->find('system:schedulerState');
$command = $application['console']->find('system:schedulerState');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()));

View File

@@ -2,8 +2,8 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\CLI;
use Symfony\Component\Console\Tester\CommandTester;
use \Symfony\Component\Console\Application;
class module_console_systemTemplateGeneratorTest extends PHPUnit_Framework_TestCase
{
@@ -11,10 +11,10 @@ class module_console_systemTemplateGeneratorTest extends PHPUnit_Framework_TestC
public function testExecute()
{
// mock the Kernel or create one depending on your needs
$application = new Application();
$application->add(new module_console_systemTemplateGenerator('system:templateGenerator'));
$application = new CLI('test');
$application->command(new module_console_systemTemplateGenerator('system:templateGenerator'));
$command = $application->find('system:templateGenerator');
$command = $application['console']->find('system:templateGenerator');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()));

View File

@@ -2,8 +2,8 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\CLI;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Application;
class module_console_taskStateTest extends PhraseanetPHPUnitAbstract
{
@@ -14,10 +14,10 @@ class module_console_taskStateTest extends PhraseanetPHPUnitAbstract
public function testExecute()
{
// mock the Kernel or create one depending on your needs
$application = new Application();
$application->add(new module_console_taskState('system:taskState'));
$application = new CLI('test');
$application->command(new module_console_taskState('system:taskState'));
$command = $application->find('system:taskState');
$command = $application['console']->find('system:taskState');
$commandTester = new CommandTester($command);
// test a bad argument

View File

@@ -2,8 +2,8 @@
require_once __DIR__ . '/../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
use Alchemy\Phrasea\CLI;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Application;
class module_console_tasklistTest extends PHPUnit_Framework_TestCase
{
@@ -14,10 +14,10 @@ class module_console_tasklistTest extends PHPUnit_Framework_TestCase
public function testExecute()
{
// mock the Kernel or create one depending on your needs
$application = new Application();
$application->add(new module_console_tasklist('task:list'));
$application = new CLI('test');
$application->command(new module_console_tasklist('task:list'));
$command = $application->find('task:list');
$command = $application['console']->find('task:list');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName()));