Completed
Pull Request — master (#202)
by Sam
10:26
created

StitchDataSenderTest::testAddonToJson()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
use SilverStripe\Elastica\Searchable;
5
6
/**
7
 * Tests for StitchDataSender
8
 */
9
class StitchDataSenderTest extends SapphireTest
10
{
11
12
    protected static $fixture_file = 'mysite/tests/services/testAddon.yml';
13
14
    public function setUp()
15
    {
16
        Injector::inst()->registerService(new Searchable(null), Searchable::class);
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a object<SilverStripe\Elastica\ElasticaService>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
new \SilverStripe\Elastica\Searchable(null) is of type object<SilverStripe\Elastica\Searchable>, but the function expects a object<stdClass>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
17
        parent::setUp();
18
    }
19
20
    public function testAddonToJson()
21
    {
22
        $s = new StitchDataSender();
23
        print_r($s->addonToJson($this->objFromFixture('Addon', 'addon_a')));
0 ignored issues
show
Documentation introduced by
$this->objFromFixture('Addon', 'addon_a') is of type object<DataObject>|null, but the function expects a object<Addon>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
24
    }
25
}
26