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

testFoxyStripePurchaseForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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