Code Duplication    Length = 32-39 lines in 3 locations

tests/CareCleaningDocTest.php 1 location

@@ 3-34 (lines=32) @@
1
<?php
2
3
class CareCleaningDocTest extends SapphireTest
4
{
5
    /**
6
     * @var string
7
     */
8
    protected static $fixture_file = 'product-catalog/tests/fixtures.yml';
9
10
    /**
11
     *
12
     */
13
    public function testGetCMSFields()
14
    {
15
        $object = new CareCleaningDoc();
16
        $fields = $object->getCMSFields();
17
        $this->assertInstanceOf('FieldList', $fields);
18
        $this->assertNull($fields->dataFieldByName('Products'));
19
20
        $object = $this->objFromFixture('CareCleaningDoc', 'one');
21
        $fields = $object->getCMSFields();
22
        $this->assertInstanceOf('FieldList', $fields);
23
        $this->assertNotNull($fields->dataFieldByName('Products'));
24
    }
25
26
    /**
27
     *
28
     */
29
    public function testGetProductsCt()
30
    {
31
        $object = $this->objFromFixture('CareCleaningDoc', 'one');
32
        $this->assertEquals($object->getProductsCt(), 1);
33
    }
34
}
35

tests/WarrantyTest.php 1 location

@@ 3-34 (lines=32) @@
1
<?php
2
3
class WarrantyTest extends SapphireTest
4
{
5
    /**
6
     * @var string
7
     */
8
    protected static $fixture_file = 'product-catalog/tests/fixtures.yml';
9
10
    /**
11
     *
12
     */
13
    public function testGetCMSFields()
14
    {
15
        $object = new Warranty();
16
        $fields = $object->getCMSFields();
17
        $this->assertInstanceOf('FieldList', $fields);
18
        $this->assertNull($fields->dataFieldByName('Products'));
19
20
        $object = $this->objFromFixture('Warranty', 'one');
21
        $fields = $object->getCMSFields();
22
        $this->assertInstanceOf('FieldList', $fields);
23
        $this->assertNotNull($fields->dataFieldByName('Products'));
24
    }
25
26
    /**
27
     *
28
     */
29
    public function testGetProductsCt()
30
    {
31
        $object = $this->objFromFixture('Warranty', 'one');
32
        $this->assertEquals($object->getProductsCt(), 1);
33
    }
34
}
35

tests/ProductDocCollectionDataExtensionTest.php 1 location

@@ 3-41 (lines=39) @@
1
<?php
2
3
class ProductDocCollectionDataExtensionTest extends SapphireTest
4
{
5
    /**
6
     * @var string
7
     */
8
    protected static $fixture_file = 'product-catalog/tests/fixtures.yml';
9
10
    /**
11
     *
12
     */
13
    public function testUpdateCollectionObject()
14
    {
15
        $object = $this->objFromFixture('ProductDocCollection', 'default');
16
        $controller = ProductDocCollection_Controller::create($object);
17
        $this->assertEquals($controller->getCollectionObject(), 'SpecSheet');
18
    }
19
20
    /**
21
     *
22
     */
23
    public function testUpdateCollectionForm()
24
    {
25
        $object = $this->objFromFixture('ProductDocCollection', 'default');
26
        $controller = ProductDocCollection_Controller::create($object);
27
        $form = $controller->CollectionSearchForm();
28
        $this->assertNotNull($form->Fields()->dataFieldByName('CategoryID'));
29
        $this->assertNull($form->Fields()->dataFieldByName('Title'));
30
    }
31
32
    /**
33
     *
34
     */
35
    public function testUpdateCollectionItems()
36
    {
37
        $this->markTestIncomplete(
38
            'This test has not been implemented yet.'
39
        );
40
    }
41
}