Code Duplication    Length = 12-15 lines in 2 locations

tests/extensions/DMSDocumentCartExtensionTest.php 2 locations

@@ 31-42 (lines=12) @@
28
    /**
29
     * The CSS classes are required for the CMS Javascript to work, assert that they are correct
30
     */
31
    public function testCmsFieldsHaveRequiredCssClasses()
32
    {
33
        $fields = DMSDocument::create()->getCMSFields();
34
35
        $allowedInCart = $fields->fieldByName('AllowedInCart');
36
        $this->assertInstanceOf('CheckboxField', $allowedInCart);
37
        $this->assertTrue((bool) $allowedInCart->hasClass('dms-allowed-in-cart'));
38
39
        $allowedInCart = $fields->fieldByName('MaximumCartQuantity');
40
        $this->assertInstanceOf('TextField', $allowedInCart);
41
        $this->assertTrue((bool) $allowedInCart->hasClass('dms-maximum-cart-quantity'));
42
    }
43
44
    /**
45
     * Ensure that validation messages can be retrieved once, cleared, then not again
@@ 57-71 (lines=15) @@
54
    /**
55
     * Test that print request count is shown in the document's summary
56
     */
57
    public function testPrintRequestCountIsShownInDocumentSummary()
58
    {
59
        $document = $this->objFromFixture('DMSDocument', 'requested_for_print');
60
        $fields = $document->getCMSFields();
61
62
        // Results of DMSDocument::getFieldsForFile is the first in the list
63
        $summary = $fields->first();
64
        $this->assertInstanceOf('FieldGroup', $summary);
65
66
        $printRequestField = $summary->FieldList()
67
            ->fieldByName('FilePreview.FilePreviewData.FilePreviewDataFields.PrintRequestCount');
68
69
        $this->assertNotNull($printRequestField, 'Print request count field exists in DMSDocument fields');
70
        $this->assertEquals(3, $printRequestField->Value());
71
    }
72
73
    /**
74
     * @expectedException DMSDocumentCartException