Skip to content

Commit

Permalink
#12 SiwappBaseTest test class to be inherited.
Browse files Browse the repository at this point in the history
  also, sqlite db for testing purpses (more speed)
  • Loading branch information
JoeZ99 committed Dec 11, 2011
1 parent 6bc261b commit 782f06d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
10 changes: 10 additions & 0 deletions app/config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ web_profiler:

swiftmailer:
disable_delivery: true

doctrine:
dbal:
driver: pdo_sqlite
path: :memory:
memory: true
orm:
auto_generate_proxy_classes: true
auto_mapping: true

32 changes: 32 additions & 0 deletions src/Siwapp/CoreBundle/Tests/Model/SiwappBaseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Symfony\Bundle\FrameworkBundle\Console\Application;

class SiwappBaseTest extends PHPUnit_Framework_TestCase
{
protected $_application;

public function setUp()
{
$kernel = new \AppKernel("test", true);
$kernel->boot();
$this->_application = new Application($kernel);
$this->_application->setAutoExit(false);
$this->runConsole("doctrine:schema:drop", array("--force" => true));
$this->runConsole("doctrine:schema:create");
$this->runConsole("cache:warmup");
$this->runConsole("doctrine:fixtures:load", array("--fixtures" => __DIR__ . "/../DataFixtures"));
}

protected function runConsole($command, Array $options = array())
{
$options["-e"] = "test";
$options["-q"] = null;
$options = array_merge($options, array('command' => $command));
return $this->_application->run(new \Symfony\Component\Console\Input\ArrayInput($options));
}

public function testDummy()
{
}
}
11 changes: 6 additions & 5 deletions src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

use Siwapp\InvoiceBundle\Entity\Invoice;
use Symfony\Bundle\FrameworkBundle\Console\Application;

class InvoiceTest extends PHPUnit_Framework_TestCase
{
public function testTrial()
{
$inv = new Invoice();
$this->assertEquals(0,0);
}
public function testTrial()
{
$inv = new Invoice();
$this->assertEquals(0,0);
}
}

0 comments on commit 782f06d

Please sign in to comment.