TaxRateTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace SilverCommerce\TaxAdmin\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use SilverStripe\Core\Config\Config;
7
use SilverCommerce\GeoZones\Model\Region;
8
use SilverCommerce\TaxAdmin\Model\TaxRate;
9
use SilverCommerce\TaxAdmin\Tests\Model\TestProduct;
10
11
/**
12
 * Test functionality of postage extension
13
 *
14
 */
15
class TaxRateTest extends SapphireTest
16
{
17
18
    protected static $fixture_file = 'TaxData.yml';
19
20
    /**
21
     * Setup test only objects
22
     *
23
     * @var array
24
     */
25
    protected static $extra_dataobjects = [
26
        TestProduct::class
27
    ];
28
29
    public function setUp()
30
    {
31
        parent::setUp();
32
        Config::inst()->set(Region::class, "create_on_build", false);
0 ignored issues
show
Bug introduced by
The method set() does not exist on SilverStripe\Config\Coll...nfigCollectionInterface. It seems like you code against a sub-type of SilverStripe\Config\Coll...nfigCollectionInterface such as SilverStripe\Config\Coll...nfigCollectionInterface. ( Ignorable by Annotation )

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

32
        Config::inst()->/** @scrutinizer ignore-call */ set(Region::class, "create_on_build", false);
Loading history...
33
    }
34
35
    /**
36
     * Test that Tax Rate returns an accurate list
37
     */
38
    public function testZonesList()
39
    {
40
        $obj = $this->objFromFixture(TaxRate::class, "vat");
41
42
        // Test default location
43
        $this->assertTrue(strpos($obj->ZonesList, "UK") !== false);
44
        $this->assertTrue(strpos($obj->ZonesList, "Germany") !== false);
45
    }
46
}
47