Passed
Pull Request — master (#111)
by Jason
02:35
created

ShippableTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dynamic\Foxy\Test\Extension;
4
5
use Dynamic\Foxy\Extension\Purchasable;
6
use Dynamic\Foxy\Model\Variation;
7
use Dynamic\Foxy\Test\TestOnly\TestProduct;
8
use Dynamic\Foxy\Test\TestOnly\TestShippableProduct;
9
use Dynamic\Foxy\Test\TestOnly\TestVariation;
10
use SilverStripe\Core\Config\Config;
11
use SilverStripe\Core\Injector\Injector;
12
use SilverStripe\Dev\Debug;
13
use SilverStripe\Dev\SapphireTest;
14
use SilverStripe\Forms\FieldList;
15
16
/**
17
 * Class ShippableTest
18
 * @package Dynamic\Foxy\Test\Extension
19
 */
20
class ShippableTest extends SapphireTest
21
{
22
    /**
23
     * @var string
24
     */
25
    protected static $fixture_file = '../fixtures.yml';
26
27
    /**
28
     * @var array
29
     */
30
    protected static $extra_dataobjects = [
31
        TestProduct::class,
32
        TestVariation::class,
33
    ];
34
35
    /**
36
     * @var \string[][]
37
     */
38
    protected static $required_extensions = [
39
        TestProduct::class => [
40
            Purchasable::class,
41
        ],
42
    ];
43
44
    /**
45
     *
46
     */
47
    public function setUp()
48
    {
49
        Config::modify()->set(TestVariation::class, 'has_one', ['Product' => TestProduct::class]);
50
51
        return parent::setUp();
52
    }
53
54
    /**
55
     *
56
     */
57
    public function testUpdateCMSFields()
58
    {
59
        $object = Injector::inst()->create(TestShippableProduct::class);
60
        $fields = $object->getCMSFields();
61
        $this->assertInstanceOf(FieldList::class, $fields);
62
    }
63
}
64