Completed
Pull Request — master (#7)
by Jason
09:16 queued 06:28
created

FoxyStripeInventoryManagerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 36
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFoxyStripePurchaseForm() 0 5 1
A testUpdateCMSFields() 0 6 1
1
<?php
2
3
namespace Dynamic\FoxyStripe\Test;
4
5
use Dynamic\FoxyStripe\Test\TestOnly\TestOption;
6
use Dynamic\FoxyStripe\Test\TestOnly\TestProduct;
7
use Dynamic\FoxyStripe\Test\TestOnly\TestProductController;
8
use SilverStripe\Dev\SapphireTest;
9
use SilverStripe\Forms\FieldList;
10
11
class FoxyStripeInventoryManagerTest extends SapphireTest
12
{
13
    /**
14
     * @var array
15
     */
16
    protected static $fixture_file = array(
17
        '../fixtures.yml',
18
    );
19
20
    /**
21
     * @var array
22
     */
23
    protected static $extra_dataobjects = [
24
        TestProduct::class,
25
        TestOption::class,
26
    ];
27
28
    /**
29
     *
30
     */
31
    public function testUpdateCMSFields()
32
    {
33
        $object = $this->objFromFixture(TestProduct::class, 'one');
34
        $fields = $object->getCMSFields();
35
        $this->assertInstanceOf(FieldList::class, $fields);
36
        $this->assertNotNull($fields->dataFieldByName('ControlInventory'));
37
    }
38
39
    /**
40
     *
41
     */
42
    public function testFoxyStripePurchaseForm()
43
    {
44
        $object = $this->objFromFixture(TestProduct::class, 'one');
45
        $controller = new TestProductController($object);
46
        $this->assertFalse($controller->PurchaseForm());
0 ignored issues
show
Bug introduced by
$controller->PurchaseForm() of type Dynamic\FoxyStripe\Form\FoxyStripePurchaseForm is incompatible with the type boolean expected by parameter $condition of PHPUnit_Framework_Assert::assertFalse(). ( Ignorable by Annotation )

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

46
        $this->assertFalse(/** @scrutinizer ignore-type */ $controller->PurchaseForm());
Loading history...
47
    }
48
}
49