SolrEngineTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testUpdateAddsModelsToTheIndex() 0 15 1
A testDeleteRemovesUpdatesFromTheIndex() 0 2 1
A testResultsGetMappedToTheCorrectModels() 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)
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

15
        $solrClient = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder(Client::class)

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
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
    public function testSearchSendsCorrectConditionsToSolr()
35
    {
36
    }
37
38
    public function testResultsGetMappedToTheCorrectModels()
39
    {
40
    }
41
}
42