Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jajm committed Sep 13, 2016
1 parent e1d8bc8 commit 7c1890f
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
10 changes: 10 additions & 0 deletions composer.json
@@ -0,0 +1,10 @@
{
"require-dev": {
"biblibre/omeka-s-test-helper": "dev-master"
},
"autoload-dev": {
"psr-4": {
"IdRefTest\\": "test/IdRefTest/"
}
}
}
56 changes: 56 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions test/IdRefTest/Controller/Admin/IdRefControllerTest.php
@@ -0,0 +1,25 @@
<?php

namespace IdRefTest\Controller;

use OmekaTestHelper\Controller\OmekaControllerTestCase;

class IdRefControllerTest extends OmekaControllerTestCase
{
public function setup()
{
parent::setup();
$this->loginAsAdmin();
}

public function testSearchAction()
{
$this->dispatch('/admin/idref/search?term=hugo');
$this->assertResponseStatusCode(200);
$this->assertResponseHeaderContains('Content-Type', 'application/json; charset=utf-8');

$results = json_decode($this->getResponse()->getContent());
$this->assertNotNull($results);
$this->assertTrue(is_array($results));
}
}
9 changes: 9 additions & 0 deletions test/bootstrap.php
@@ -0,0 +1,9 @@
<?php

require __DIR__ . '/../vendor/autoload.php';

use OmekaTestHelper\Bootstrap;

Bootstrap::bootstrap(__DIR__);
Bootstrap::loginAsAdmin();
Bootstrap::enableModule('IdRef');
9 changes: 9 additions & 0 deletions test/phpunit.xml
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./bootstrap.php" colors="true" backupGlobals="false">
<testsuites>
<testsuite name="IdRef">
<directory>./IdRefTest</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 7c1890f

Please sign in to comment.