TASK: Refactor tests

* Have necessary setup in all tests.
* Added todos
This commit is contained in:
Daniel Siepmann 2016-12-10 14:41:48 +01:00
parent c3763a0982
commit 67463fa135
5 changed files with 16 additions and 7 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>1</uid>
<pid>0</pid>
<title>Root page containing necessary TypoScript</title>
</pages>
</dataset>

View file

@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<dataset> <dataset>
<pages>
<uid>1</uid>
<pid>0</pid>
<title>Page Title</title>
</pages>
<tt_content> <tt_content>
<uid>6</uid> <uid>6</uid>
<pid>1</pid> <pid>1</pid>

View file

@ -40,6 +40,10 @@ abstract class FunctionalTestCase extends CoreTestCase
{ {
parent::setUp(); parent::setUp();
// Provide necessary configuration for extension
$this->importDataSet('Tests/Functional/Fixtures/BasicSetup.xml');
$this->setUpFrontendRootPage(1, ['EXT:search_core/Tests/Functional/Fixtures/BasicSetup.ts']);
// Create client to make requests and assert something. // Create client to make requests and assert something.
$this->client = new \Elastica\Client([ $this->client = new \Elastica\Client([
'host' => getenv('ES_HOST') ?: \Elastica\Connection::DEFAULT_HOST, 'host' => getenv('ES_HOST') ?: \Elastica\Connection::DEFAULT_HOST,

View file

@ -34,7 +34,6 @@ class IndexTcaTableTest extends FunctionalTestCase
parent::setUp(); parent::setUp();
$this->importDataSet('Tests/Functional/Fixtures/Indexing/IndexTcaTable.xml'); $this->importDataSet('Tests/Functional/Fixtures/Indexing/IndexTcaTable.xml');
$this->setUpFrontendRootPage(1, ['EXT:search_core/Tests/Functional/Fixtures/Indexing/IndexTcaTable.ts']);
} }
/** /**
@ -53,4 +52,8 @@ class IndexTcaTableTest extends FunctionalTestCase
$this->assertTrue($response->isOK()); $this->assertTrue($response->isOK());
$this->assertSame($response->getData()['hits']['total'], 1, 'Not exactly 1 document was indexed.'); $this->assertSame($response->getData()['hits']['total'], 1, 'Not exactly 1 document was indexed.');
} }
// TODO: Add tests for hook.
// TODO: Add tests for search in frontend.
} }