Completed
Push — master ( f8f77e...d2a4ab )
by Jason
05:01
created

StoreSettingsTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
1
<?php
2
3
namespace Dynamic\FoxyStripe\Test;
4
5
use Dynamic\FoxyStripe\Model\FoxyCart;
6
use SilverStripe\SiteConfig\SiteConfig;
7
8
class StoreSettingsTest extends FS_Test
9
{
10
    /**
11
     * @var bool
12
     */
13
    protected static $use_draft_site = true;
14
15
    /**
16
     * @throws \SilverStripe\ORM\ValidationException
17
     */
18
    public function setUp()
19
    {
20
        parent::setUp();
21
22
        $siteConf = SiteConfig::current_site_config();
23
        $siteConf->StoreName = 'foxystripe';
24
        $siteConf->requireDefaultRecords();
25
        $siteConf->write();
26
    }
27
28
    /**
29
     *
30
     */
31
    public function testStoreKey()
32
    {
33
        $pref = FoxyCart::getKeyPrefix();
34
        $siteConf = SiteConfig::current_site_config();
35
36
        $this->assertTrue(ctype_alnum($siteConf->StoreKey));
37
        $this->assertEquals(strlen($siteConf->StoreKey), 60);
38
        $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref);
39
    }
40
41
    /**
42
     *
43
     */
44
    public function testStoreName()
45
    {
46
        $siteConf = SiteConfig::current_site_config();
47
48
        $this->assertEquals($siteConf->StoreName, 'foxystripe');
49
    }
50
}
51