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:
parent
324e96b48f
commit
cee7dbc90a
@ -23,6 +23,10 @@ Then you should initialize your database by running:
|
|||||||
|
|
||||||
# Test
|
# Test
|
||||||
|
|
||||||
To run the test suite just use:
|
For unit tests (using Atoum) use:
|
||||||
|
|
||||||
./console tests:unit
|
./console tests:unit
|
||||||
|
|
||||||
|
For functional tests you'll need phpunit:
|
||||||
|
|
||||||
|
phpunit
|
||||||
|
18
phpunit.xml
Normal file
18
phpunit.xml
Normal 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>
|
35
tests/functionals/ApiTest.php
Normal file
35
tests/functionals/ApiTest.php
Normal 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() == '[]');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user