1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-12-18 05:32:23 -05:00

Add simple functional test

This commit is contained in:
Vincent Jousse 2013-11-22 23:54:20 +01:00
parent 324e96b48f
commit cee7dbc90a
3 changed files with 58 additions and 1 deletions

View File

@ -23,6 +23,10 @@ Then you should initialize your database by running:
# Test
To run the test suite just use:
For unit tests (using Atoum) use:
./console tests:unit
For functional tests you'll need phpunit:
phpunit

18
phpunit.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Poche Test Suite">
<directory>./tests/functionals/</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -0,0 +1,35 @@
<?php
namespace Poche\Tests\Functionals;
use Silex\WebTestCase;
class ApiTest extends WebTestCase
{
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');
$this->assertTrue($client->getResponse()->isOk());
// Assert that the "Content-Type" header is "application/json"
$this->assertTrue(
$client->getResponse()->headers->contains(
'Content-Type',
'application/json'
)
);
$this->assertTrue($client->getResponse()->getContent() == '[]');
}
}