Passed
Push — master ( 9975a0...1b82ab )
by Jeroen
02:06
created

SolrEngineTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 31
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testUpdateAddsModelsToTheIndex() 0 15 1
A testResultsGetMappedToTheCorrectModels() 0 2 1
A testDeleteRemovesUpdatesFromTheIndex() 0 2 1
A testSearchSendsCorrectConditionsToSolr() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Eloquent\Collection;
6
use PHPUnit\Framework\TestCase;
7
use ScoutEngines\Solr\SolrEngine;
8
use Solarium\Client;
9
use Solarium\QueryType\Update\Query\Query;
10
11
class SolrEngineTest extends TestCase
12
{
13
    public function testUpdateAddsModelsToTheIndex()
14
    {
15
        $solrClient = $this->getMockBuilder(Client::class)
16
            ->setMethods(['update'])
17
            ->getMock();
18
19
        $query = new Query();
20
21
        $solrClient->expects($this->once())
22
            ->method('update')
23
            ->with($this->equalTo($query));
24
25
        $engine = new SolrEngine($solrClient);
26
27
        $engine->update(Collection::make([new SolrEngineTestModel]));
28
    }
29
30
    public function testDeleteRemovesUpdatesFromTheIndex()
31
    {
32
33
    }
34
35
    public function testSearchSendsCorrectConditionsToSolr()
36
    {
37
38
    }
39
40
    public function testResultsGetMappedToTheCorrectModels()
41
    {
42
43
    }
44
}