Issues (236)

tests/StoreSettingsTest.php (1 issue)

1
<?php
2
3
namespace Dynamic\FoxyStripe\Test;
4
5
use Dynamic\FoxyStripe\Model\FoxyCart;
6
use Dynamic\FoxyStripe\Model\FoxyStripeSetting;
7
use SilverStripe\SiteConfig\SiteConfig;
8
9
class StoreSettingsTest extends FS_Test
10
{
11
    /**
12
     * @var bool
13
     */
14
    protected static $use_draft_site = true;
15
16
    /**
17
     * @throws \SilverStripe\ORM\ValidationException
18
     */
19
    public function setUp()
20
    {
21
        parent::setUp();
22
23
        $siteConf = FoxyStripeSetting::current_foxystripe_setting();
24
        $siteConf->StoreName = 'foxystripe';
0 ignored issues
show
Documentation Bug introduced by
It seems like 'foxystripe' of type string is incompatible with the declared type SilverStripe\ORM\FieldType\DBVarchar of property $StoreName.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25
        $siteConf->requireDefaultRecords();
26
        $siteConf->write();
27
    }
28
29
    /**
30
     *
31
     */
32
    public function testStoreKey()
33
    {
34
        $pref = FoxyCart::getKeyPrefix();
35
        $siteConf = FoxyStripeSetting::current_foxystripe_setting();
36
37
        $this->assertTrue(ctype_alnum($siteConf->StoreKey));
38
        $this->assertEquals(strlen($siteConf->StoreKey), 60);
39
        $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref);
40
    }
41
42
    /**
43
     *
44
     */
45
    public function testStoreName()
46
    {
47
        $siteConf = FoxyStripeSetting::current_foxystripe_setting();
48
49
        $this->assertEquals($siteConf->StoreName, 'foxystripe');
50
    }
51
}
52