diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-08-19 11:18:04 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-08-19 11:18:04 +0300 |
commit | ea9761bce7fbb486c60a084af07ffe11078ec5f1 (patch) | |
tree | 150071765ceaa0c7105bb99b92b488ba3f39faf6 /lib | |
parent | a435a19f874ee07a83832c85154157aacf410232 (diff) |
fixing test
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Command/Index.php | 4 | ||||
-rw-r--r-- | lib/Command/Test.php | 33 | ||||
-rw-r--r-- | lib/Service/TestService.php | 2 |
3 files changed, 27 insertions, 12 deletions
diff --git a/lib/Command/Index.php b/lib/Command/Index.php index 3c05e58..117067b 100644 --- a/lib/Command/Index.php +++ b/lib/Command/Index.php @@ -324,7 +324,9 @@ class Index extends ExtendedBase { */ private function testPlatform() { $platform = $this->platformService->getPlatform(); - $platform->testPlatform(); + if (!$platform->testPlatform()) { + throw new Exception('failed platform test.'); + } } diff --git a/lib/Command/Test.php b/lib/Command/Test.php index 1cbdaa8..f13469f 100644 --- a/lib/Command/Test.php +++ b/lib/Command/Test.php @@ -153,6 +153,7 @@ class Test extends ExtendedBase { try { $this->testResetTest($output, $testProvider); $this->pause($output, $platformDelay); + $this->testInitIndexing($output, $testPlatform); $this->testIndexingDocuments($output, $testPlatform, $testProvider); $this->pause($output, $platformDelay); $this->testContentLicense($output, $testPlatform); @@ -271,15 +272,14 @@ class Test extends ExtendedBase { $this->output($output, true); $this->output($output, 'Testing search platform.'); - $this->output( - $output, (($testPlatform->testPlatform()) ? 'found index' : 'index not found'), false - ); + if (!$testPlatform->testPlatform()) { + throw new Exception ('Search platform (' . $testPlatform->getName() . ') down ?'); + } $this->output($output, true); return $testPlatform; } - /** * @param OutputInterface $output * @param IFullTextSearchPlatform $testPlatform @@ -318,6 +318,18 @@ class Test extends ExtendedBase { /** * @param OutputInterface $output * @param IFullTextSearchPlatform $testPlatform + */ + private function testInitIndexing(OutputInterface $output, IFullTextSearchPlatform $testPlatform + ) { + $this->output($output, 'Initializing index mapping.'); + $testPlatform->initializeIndex(); + $this->output($output, true); + } + + + /** + * @param OutputInterface $output + * @param IFullTextSearchPlatform $testPlatform * @param IFullTextSearchProvider $testProvider * * @throws InterruptException @@ -398,27 +410,28 @@ class Test extends ExtendedBase { [TestService::DOCUMENT_TYPE_SIMPLE] ); $this->search( - $output, $testPlatform, $testProvider, $access, 'this is test', + $output, $testPlatform, $testProvider, $access, 'document is a simple test', +// [TestService::DOCUMENT_TYPE_SIMPLE] [TestService::DOCUMENT_TYPE_SIMPLE, TestService::DOCUMENT_TYPE_LICENSE] ); $this->search( - $output, $testPlatform, $testProvider, $access, '"this is test"', + $output, $testPlatform, $testProvider, $access, '"document is a test"', [] ); $this->search( - $output, $testPlatform, $testProvider, $access, '"this is a test"', + $output, $testPlatform, $testProvider, $access, '"document is a simple test"', [TestService::DOCUMENT_TYPE_SIMPLE] ); $this->search( - $output, $testPlatform, $testProvider, $access, 'this is -test', + $output, $testPlatform, $testProvider, $access, 'document is a simple -test', [TestService::DOCUMENT_TYPE_LICENSE] ); $this->search( - $output, $testPlatform, $testProvider, $access, 'this is +test', + $output, $testPlatform, $testProvider, $access, 'document is a simple +test', [TestService::DOCUMENT_TYPE_SIMPLE] ); $this->search( - $output, $testPlatform, $testProvider, $access, '-this is test', + $output, $testPlatform, $testProvider, $access, '-document is a simple test', [] ); } diff --git a/lib/Service/TestService.php b/lib/Service/TestService.php index 4900c69..2954a99 100644 --- a/lib/Service/TestService.php +++ b/lib/Service/TestService.php @@ -99,7 +99,7 @@ class TestService { public function generateIndexDocumentSimple(IndexOptions $options) { $indexDocument = $this->generateIndexDocument(self::DOCUMENT_TYPE_SIMPLE); - $indexDocument->setContent('This is a test'); + $indexDocument->setContent('document is a simple test'); return $indexDocument; } |