mirror of
https://github.com/moparisthebest/wallabag
synced 2024-12-18 05:32:23 -05:00
Use sqlite test db
This commit is contained in:
parent
b30f5bd72d
commit
bc1a3342c3
@ -28,7 +28,7 @@ class CreateSchemaCommand extends BaseCommand
|
||||
$app = $this->getSilexApplication();
|
||||
$db = $app['db'];
|
||||
|
||||
Schema::executeSchema($db);
|
||||
Schema::createTables($db);
|
||||
|
||||
$output->writeln("<info>Schema created</info>");
|
||||
}
|
||||
|
@ -5,7 +5,17 @@ use Poche\Util\Token;
|
||||
|
||||
class Schema
|
||||
{
|
||||
public static function executeSchema($db) {
|
||||
|
||||
public static function dropTables($db) {
|
||||
$db->query("DROP TABLE IF EXISTS config");
|
||||
$db->query("DROP TABLE IF EXISTS users");
|
||||
$db->query("DROP TABLE IF EXISTS entries");
|
||||
$db->query("DROP TABLE IF EXISTS tags");
|
||||
$db->query("DROP TABLE IF EXISTS tags_entries");
|
||||
$db->query("DROP TABLE IF EXISTS plugin_options");
|
||||
}
|
||||
|
||||
public static function createTables($db) {
|
||||
|
||||
$db->query("
|
||||
CREATE TABLE config (
|
||||
|
@ -1,30 +1,18 @@
|
||||
<?php
|
||||
namespace Poche\Tests\Functionals;
|
||||
|
||||
use Silex\WebTestCase;
|
||||
require __DIR__.'/PocheWebTestCase.php';
|
||||
|
||||
class ApiTest extends WebTestCase
|
||||
|
||||
class ApiTest extends PocheWebTestCase
|
||||
{
|
||||
public function createApplication()
|
||||
{
|
||||
require __DIR__.'/../../app/app.php';
|
||||
require __DIR__ . '/../../app/controllers/controllers.php';
|
||||
|
||||
$app['debug'] = true;
|
||||
|
||||
return $app;
|
||||
}
|
||||
|
||||
public function testGetEntries()
|
||||
{
|
||||
$client = $this->createClient();
|
||||
$crawler = $client->request('GET', '/api/entries');
|
||||
|
||||
echo($client->getResponse()->getContent());die;
|
||||
|
||||
$this->assertTrue($client->getResponse()->isOk());
|
||||
|
||||
|
||||
// Assert that the "Content-Type" header is "application/json"
|
||||
$this->assertTrue(
|
||||
$client->getResponse()->headers->contains(
|
||||
|
27
tests/functionals/PocheWebTestCase.php
Normal file
27
tests/functionals/PocheWebTestCase.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace Poche\Tests\Functionals;
|
||||
|
||||
use Silex\WebTestCase;
|
||||
|
||||
use Poche\Schema;
|
||||
|
||||
class PocheWebTestCase extends WebTestCase
|
||||
{
|
||||
public function createApplication()
|
||||
{
|
||||
require __DIR__.'/../../app/app.php';
|
||||
require __DIR__ . '/../../app/controllers/controllers.php';
|
||||
|
||||
$app['db.options'] = array(
|
||||
'driver' => 'pdo_sqlite',
|
||||
'path' => __DIR__.'/poche_test.db'
|
||||
);
|
||||
|
||||
$app['debug'] = true;
|
||||
|
||||
Schema::dropTables($app['db']);
|
||||
Schema::createTables($app['db']);
|
||||
|
||||
return $app;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user