Code Duplication    Length = 36-36 lines in 3 locations

eZ/Publish/Core/Repository/Tests/Values/Content/ContentInfoTest.php 1 location

@@ 14-49 (lines=36) @@
11
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
12
use PHPUnit_Framework_TestCase;
13
14
class ContentInfoTest extends PHPUnit_Framework_TestCase
15
{
16
    /**
17
     * @covers \eZ\Publish\API\Repository\Values\Content\ContentInfo::getProperties
18
     */
19
    public function testObjectProperties()
20
    {
21
        $object = new ContentInfo();
22
        $properties = $object->attributes();
23
        self::assertNotContains('internalFields', $properties, 'Internal property found ');
24
        self::assertContains('contentTypeId', $properties, 'Property not found');
25
        self::assertContains('id', $properties, 'Property not found');
26
        self::assertContains('name', $properties, 'Property not found');
27
        self::assertContains('sectionId', $properties, 'Property not found');
28
        self::assertContains('currentVersionNo', $properties, 'Property not found');
29
        self::assertContains('published', $properties, 'Property not found');
30
        self::assertContains('ownerId', $properties, 'Property not found');
31
        self::assertContains('modificationDate', $properties, 'Property not found');
32
        self::assertContains('publishedDate', $properties, 'Property not found');
33
        self::assertContains('alwaysAvailable', $properties, 'Property not found');
34
        self::assertContains('remoteId', $properties, 'Property not found');
35
        self::assertContains('mainLanguageCode', $properties, 'Property not found');
36
        self::assertContains('mainLocationId', $properties, 'Property not found');
37
38
        // check for duplicates and double check existence of property
39
        $propertiesHash = array();
40
        foreach ($properties as $property) {
41
            if (isset($propertiesHash[$property])) {
42
                self::fail("Property '{$property}' exists several times in properties list");
43
            } elseif (!isset($object->$property)) {
44
                self::fail("Property '{$property}' does not exist on object, even though it was hinted to be there");
45
            }
46
            $propertiesHash[$property] = 1;
47
        }
48
    }
49
}
50

eZ/Publish/Core/Repository/Tests/Values/Content/LocationTest.php 1 location

@@ 14-49 (lines=36) @@
11
use eZ\Publish\Core\Repository\Values\Content\Location;
12
use PHPUnit_Framework_TestCase;
13
14
class LocationTest extends PHPUnit_Framework_TestCase
15
{
16
    /**
17
     * @covers \eZ\Publish\Core\Repository\Values\Content\Location::getProperties
18
     */
19
    public function testObjectProperties()
20
    {
21
        $object = new Location();
22
        $properties = $object->attributes();
23
        //self::assertNotContains( 'internalFields', $properties, 'Internal property found ' );
24
        self::assertContains('contentInfo', $properties, 'Property not found');
25
        self::assertContains('contentId', $properties, 'Property not found');
26
        self::assertContains('id', $properties, 'Property not found');
27
        self::assertContains('priority', $properties, 'Property not found');
28
        self::assertContains('hidden', $properties, 'Property not found');
29
        self::assertContains('invisible', $properties, 'Property not found');
30
        self::assertContains('remoteId', $properties, 'Property not found');
31
        self::assertContains('parentLocationId', $properties, 'Property not found');
32
        self::assertContains('pathString', $properties, 'Property not found');
33
        self::assertContains('path', $properties, 'Property not found');
34
        self::assertContains('depth', $properties, 'Property not found');
35
        self::assertContains('sortField', $properties, 'Property not found');
36
        self::assertContains('sortOrder', $properties, 'Property not found');
37
38
        // check for duplicates and double check existence of property
39
        $propertiesHash = array();
40
        foreach ($properties as $property) {
41
            if (isset($propertiesHash[$property])) {
42
                self::fail("Property '{$property}' exists several times in properties list");
43
            } elseif (!isset($object->$property)) {
44
                self::fail("Property '{$property}' does not exist on object, even though it was hinted to be there");
45
            }
46
            $propertiesHash[$property] = 1;
47
        }
48
    }
49
}
50

eZ/Publish/Core/Repository/Tests/Values/Content/TrashItemTest.php 1 location

@@ 14-49 (lines=36) @@
11
use eZ\Publish\Core\Repository\Values\Content\TrashItem;
12
use PHPUnit_Framework_TestCase;
13
14
class TrashItemTest extends PHPUnit_Framework_TestCase
15
{
16
    /**
17
     * @covers \eZ\Publish\Core\Repository\Values\Content\TrashItem::getProperties
18
     */
19
    public function testObjectProperties()
20
    {
21
        $object = new TrashItem();
22
        $properties = $object->attributes();
23
        //self::assertNotContains( 'internalFields', $properties, 'Internal property found ' );
24
        self::assertContains('contentInfo', $properties, 'Property not found');
25
        self::assertContains('contentId', $properties, 'Property not found');
26
        self::assertContains('id', $properties, 'Property not found');
27
        self::assertContains('priority', $properties, 'Property not found');
28
        self::assertContains('hidden', $properties, 'Property not found');
29
        self::assertContains('invisible', $properties, 'Property not found');
30
        self::assertContains('remoteId', $properties, 'Property not found');
31
        self::assertContains('parentLocationId', $properties, 'Property not found');
32
        self::assertContains('pathString', $properties, 'Property not found');
33
        self::assertContains('path', $properties, 'Property not found');
34
        self::assertContains('depth', $properties, 'Property not found');
35
        self::assertContains('sortField', $properties, 'Property not found');
36
        self::assertContains('sortOrder', $properties, 'Property not found');
37
38
        // check for duplicates and double check existence of property
39
        $propertiesHash = array();
40
        foreach ($properties as $property) {
41
            if (isset($propertiesHash[$property])) {
42
                self::fail("Property '{$property}' exists several times in properties list");
43
            } elseif (!isset($object->$property)) {
44
                self::fail("Property '{$property}' does not exist on object, even though it was hinted to be there");
45
            }
46
            $propertiesHash[$property] = 1;
47
        }
48
    }
49
}
50