From 782f06dfe36c6f09c40c9c2f4851ff13af15cad0 Mon Sep 17 00:00:00 2001 From: Joe Z Date: Sun, 11 Dec 2011 00:10:57 -0500 Subject: [PATCH] #12 SiwappBaseTest test class to be inherited. also, sqlite db for testing purpses (more speed) --- app/config/config_test.yml | 10 ++++++ .../CoreBundle/Tests/Model/SiwappBaseTest.php | 32 +++++++++++++++++++ .../InvoiceBundle/Tests/Model/InvoiceTest.php | 11 ++++--- 3 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 src/Siwapp/CoreBundle/Tests/Model/SiwappBaseTest.php diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 7dba2fb..1c67e23 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -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 + diff --git a/src/Siwapp/CoreBundle/Tests/Model/SiwappBaseTest.php b/src/Siwapp/CoreBundle/Tests/Model/SiwappBaseTest.php new file mode 100644 index 0000000..06e8c81 --- /dev/null +++ b/src/Siwapp/CoreBundle/Tests/Model/SiwappBaseTest.php @@ -0,0 +1,32 @@ +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() + { + } +} \ No newline at end of file diff --git a/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php b/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php index c06fc97..742f5ee 100644 --- a/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php +++ b/src/Siwapp/InvoiceBundle/Tests/Model/InvoiceTest.php @@ -1,12 +1,13 @@ assertEquals(0,0); - } + public function testTrial() + { + $inv = new Invoice(); + $this->assertEquals(0,0); + } } \ No newline at end of file