This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some common testing functionality to a separate base class for s…
…tage tests
- Loading branch information
Sam Stenvall
committed
Nov 7, 2017
1 parent
de94572
commit e0fe352
Showing
5 changed files
with
55 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Nord\Lumen\Elasticsearch\Tests\Pipelines\Stages; | ||
|
||
use Elasticsearch\Namespaces\IndicesNamespace; | ||
use Nord\Lumen\Elasticsearch\Contracts\ElasticsearchServiceContract; | ||
use Nord\Lumen\Elasticsearch\Tests\TestCase; | ||
|
||
/** | ||
* Class AbstractStageTestCase | ||
* @package Nord\Lumen\Elasticsearch\Tests\Pipelines\Stages; | ||
*/ | ||
abstract class AbstractStageTestCase extends TestCase | ||
{ | ||
|
||
/** | ||
* @param array $methods | ||
* | ||
* @return IndicesNamespace|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected function getMockedIndices($methods = []) | ||
{ | ||
return $this->getMockBuilder(IndicesNamespace::class) | ||
->disableOriginalConstructor() | ||
->setMethods($methods) | ||
->getMock(); | ||
} | ||
|
||
/** | ||
* @param IndicesNamespace|\PHPUnit_Framework_MockObject_MockObject $mockedIndices | ||
* | ||
* @return ElasticsearchServiceContract|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected function getMockedSearchService($mockedIndices) | ||
{ | ||
$searchService = $this->getMockBuilder(ElasticsearchServiceContract::class) | ||
->setMethods(['indices']) | ||
->getMockForAbstractClass(); | ||
|
||
$searchService->method('indices') | ||
->willReturn($mockedIndices); | ||
|
||
return $searchService; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters