Completed
Pull Request — master (#1)
by Jason
05:12
created

testFoxyStripePurchaseForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
class FoxyStripeInventoryManagerTest extends SapphireTest
4
{
5
    /**
6
     * @var array
7
     */
8
    protected static $fixture_file = array(
9
        'foxystripe-inventory/tests/fixtures.yml',
10
    );
11
12
    /**
13
     * @var array
14
     */
15
    protected $extraDataObjects = [
16
        'TestProduct',
17
    ];
18
19
    /**
20
     *
21
     */
22
    public function testUpdateCMSFields()
23
    {
24
        $object = $this->objFromFixture('TestProduct', 'one');
25
        $fields = $object->getCMSFields();
26
        $this->assertInstanceOf('FieldList', $fields);
27
        $this->assertNotNull($fields->dataFieldByName('ControlInventory'));
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<FoxyStripeInventoryManagerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
    }
29
30
    /**
31
     *
32
     */
33
    public function testFoxyStripePurchaseForm()
34
    {
35
        $object = $this->objFromFixture('TestProduct', 'one');
36
        $controller = new TestProduct_Controller($object);
37
        $this->assertFalse($controller->PurchaseForm());
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<FoxyStripeInventoryManagerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
    }
39
}
40
41
class TestProduct extends ProductPage implements TestOnly
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
42
{
43
    private static $extensions = ['FoxyStripeInventoryManager'];
44
}
45
46
class TestProduct_Controller extends ProductPage_Controller
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
47
{
48
    private static $extensions = ['FoxyStripeInventoryManagerExtension'];
49
}