Issues (31)

tests/Helper/SearchHelperTest.php (1 issue)

Labels
Severity
1
<?php declare(strict_types = 1);
2
3
namespace Suilven\FreeTextSearch\Tests\Helper;
4
5
use SilverStripe\CMS\Model\SiteTree;
6
use SilverStripe\Dev\SapphireTest;
7
use Suilven\FreeTextSearch\Helper\SearchHelper;
8
9
class SearchHelperTest extends SapphireTest
10
{
11
    protected static $fixture_file = ['tests/fixtures/sitetree.yml'];
12
13
    public function testTextPayload(): void
14
    {
15
        $page = SiteTree::get()->first();
16
        \error_log($page->Title);
17
18
        $helper = new SearchHelper();
19
        $payload = $helper->getTextFieldPayload($page);
0 ignored issues
show
It seems like $page can also be of type null; however, parameter $dataObject of Suilven\FreeTextSearch\H...::getTextFieldPayload() does only seem to accept SilverStripe\ORM\DataObject, maybe add an additional type check? ( Ignorable by Annotation )

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

19
        $payload = $helper->getTextFieldPayload(/** @scrutinizer ignore-type */ $page);
Loading history...
20
        $this->assertEquals(['sitetree' => [
21
            'Title' => 'The Break In San Marino Is Bright',
22
             'Content' => 'The wind in Kenya is waste',
23
             'MenuTitle' => 'The Break In San Marino Is Bright',
24
        ]], $payload);
25
    }
26
}
27