| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class SolrConfigureJobTest extends SapphireTest |
||
| 14 | { |
||
| 15 | protected static $fixture_file = '../fixtures/DataResolver.yml'; |
||
| 16 | protected static $extra_dataobjects = [ |
||
| 17 | TestObject::class, |
||
| 18 | TestPage::class, |
||
| 19 | TestRelationObject::class, |
||
| 20 | ]; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var SolrConfigureJob |
||
| 24 | */ |
||
| 25 | protected $job; |
||
| 26 | |||
| 27 | public function testGetTitle() |
||
| 28 | { |
||
| 29 | $this->assertEquals('Configure new or re-configure existing Solr cores', $this->job->getTitle()); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function testProcess() |
||
| 33 | { |
||
| 34 | $this->job->process(); |
||
| 35 | $solrResponse = file_get_contents('http://127.0.0.1:8983/solr/CircleCITestIndex/admin/ping'); |
||
| 36 | $response = json_decode($solrResponse); |
||
| 37 | $this->assertEquals('OK', $response->status); |
||
| 38 | $this->assertEquals('10', $response->responseHeader->params->rows); |
||
| 39 | } |
||
| 40 | |||
| 41 | protected function setUp() |
||
| 42 | { |
||
| 43 | Injector::inst()->get(Page::class)->requireDefaultRecords(); |
||
| 44 | foreach (self::$extra_dataobjects as $className) { |
||
| 45 | Config::modify()->merge($className, 'extensions', [DataObjectExtension::class]); |
||
| 46 | } |
||
| 47 | $this->job = Injector::inst()->get(SolrConfigureJob::class); |
||
| 48 | |||
| 49 | parent::setUp(); |
||
| 50 | } |
||
| 52 |