Code Duplication    Length = 21-21 lines in 3 locations

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

@@ 19-39 (lines=21) @@
16
    /**
17
     * @covers \eZ\Publish\Core\Repository\Values\Content\Content::getProperties
18
     */
19
    public function testObjectProperties()
20
    {
21
        $object = new Content(array('internalFields' => array()));
22
        $properties = $object->attributes();
23
        self::assertNotContains('internalFields', $properties, 'Internal property found ');
24
        self::assertContains('id', $properties, 'Property not found ');
25
        self::assertContains('fields', $properties, 'Property not found ');
26
        self::assertContains('versionInfo', $properties, 'Property not found ');
27
        self::assertContains('contentInfo', $properties, 'Property not found ');
28
29
        // check for duplicates and double check existence of property
30
        $propertiesHash = array();
31
        foreach ($properties as $property) {
32
            if (isset($propertiesHash[$property])) {
33
                self::fail("Property '{$property}' exists several times in properties list");
34
            } elseif (!isset($object->$property)) {
35
                self::fail("Property '{$property}' does not exist on object, even though it was hinted to be there");
36
            }
37
            $propertiesHash[$property] = 1;
38
        }
39
    }
40
}
41

eZ/Publish/Core/Repository/Tests/Values/User/UserGroupTest.php 1 location

@@ 56-76 (lines=21) @@
53
    /**
54
     * @covers \eZ\Publish\Core\Repository\Values\User\UserGroup::getProperties
55
     */
56
    public function testObjectProperties()
57
    {
58
        $object = new UserGroup();
59
        $properties = $object->attributes();
60
        self::assertNotContains('internalFields', $properties, 'Internal property found ');
61
        self::assertContains('id', $properties, 'Property not found ');
62
        self::assertContains('fields', $properties, 'Property not found ');
63
        self::assertContains('versionInfo', $properties, 'Property not found ');
64
        self::assertContains('contentInfo', $properties, 'Property not found ');
65
66
        // check for duplicates and double check existence of property
67
        $propertiesHash = array();
68
        foreach ($properties as $property) {
69
            if (isset($propertiesHash[$property])) {
70
                self::fail("Property '{$property}' exists several times in properties list");
71
            } elseif (!isset($object->$property)) {
72
                self::fail("Property '{$property}' does not exist on object, even though it was hinted to be there");
73
            }
74
            $propertiesHash[$property] = 1;
75
        }
76
    }
77
78
    /**
79
     * Test setting read only property.

eZ/Publish/Core/Repository/Tests/Values/User/UserTest.php 1 location

@@ 60-80 (lines=21) @@
57
    /**
58
     * @covers \eZ\Publish\Core\Repository\Values\User\User::getProperties
59
     */
60
    public function testObjectProperties()
61
    {
62
        $object = new User();
63
        $properties = $object->attributes();
64
        self::assertNotContains('internalFields', $properties, 'Internal property found ');
65
        self::assertContains('id', $properties, 'Property not found ');
66
        self::assertContains('fields', $properties, 'Property not found ');
67
        self::assertContains('versionInfo', $properties, 'Property not found ');
68
        self::assertContains('contentInfo', $properties, 'Property not found ');
69
70
        // check for duplicates and double check existence of property
71
        $propertiesHash = array();
72
        foreach ($properties as $property) {
73
            if (isset($propertiesHash[$property])) {
74
                self::fail("Property '{$property}' exists several times in properties list");
75
            } elseif (!isset($object->$property)) {
76
                self::fail("Property '{$property}' does not exist on object, even though it was hinted to be there");
77
            }
78
            $propertiesHash[$property] = 1;
79
        }
80
    }
81
82
    /**
83
     * Test setting read only property.