Code Duplication    Length = 25-25 lines in 6 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Gateway/DoctrineDatabaseTest.php 6 locations

@@ 1213-1237 (lines=25) @@
1210
    /**
1211
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteNames
1212
     */
1213
    public function testDeleteNames()
1214
    {
1215
        $this->insertDatabaseFixture(
1216
            __DIR__ . '/../_fixtures/contentobjects.php'
1217
        );
1218
1219
        $beforeCount = [
1220
            'all' => $this->countContentNames(),
1221
            'this' => $this->countContentNames(14),
1222
        ];
1223
1224
        $gateway = $this->getDatabaseGateway();
1225
        $gateway->deleteNames(14);
1226
1227
        $this->assertEquals(
1228
            [
1229
                'all' => $beforeCount['all'] - 2,
1230
                'this' => 0,
1231
            ],
1232
            [
1233
                'all' => $this->countContentNames(),
1234
                'this' => $this->countContentNames(14),
1235
            ]
1236
        );
1237
    }
1238
1239
    /**
1240
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteNames
@@ 1242-1266 (lines=25) @@
1239
    /**
1240
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteNames
1241
     */
1242
    public function testDeleteNamesWithSecondArgument()
1243
    {
1244
        $this->insertDatabaseFixture(
1245
            __DIR__ . '/../_fixtures/contentobjects.php'
1246
        );
1247
1248
        $beforeCount = [
1249
            'all' => $this->countContentNames(),
1250
            'this' => $this->countContentNames(225),
1251
        ];
1252
1253
        $gateway = $this->getDatabaseGateway();
1254
        $gateway->deleteNames(225, 2);
1255
1256
        $this->assertEquals(
1257
            [
1258
                'all' => $beforeCount['all'] - 1,
1259
                'this' => $beforeCount['this'] - 1,
1260
            ],
1261
            [
1262
                'all' => $this->countContentNames(),
1263
                'this' => $this->countContentNames(225),
1264
            ]
1265
        );
1266
    }
1267
1268
    /**
1269
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteContent
@@ 1057-1081 (lines=25) @@
1054
    /**
1055
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteFields
1056
     */
1057
    public function testDeleteFields()
1058
    {
1059
        $this->insertDatabaseFixture(
1060
            __DIR__ . '/../_fixtures/contentobjects.php'
1061
        );
1062
1063
        $beforeCount = [
1064
            'all' => $this->countContentFields(),
1065
            'this' => $this->countContentFields(4),
1066
        ];
1067
1068
        $gateway = $this->getDatabaseGateway();
1069
        $gateway->deleteFields(4);
1070
1071
        $this->assertEquals(
1072
            [
1073
                'all' => $beforeCount['all'] - 2,
1074
                'this' => 0,
1075
            ],
1076
            [
1077
                'all' => $this->countContentFields(),
1078
                'this' => $this->countContentFields(4),
1079
            ]
1080
        );
1081
    }
1082
1083
    /**
1084
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteFields
@@ 1086-1110 (lines=25) @@
1083
    /**
1084
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteFields
1085
     */
1086
    public function testDeleteFieldsWithSecondArgument()
1087
    {
1088
        $this->insertDatabaseFixture(
1089
            __DIR__ . '/../_fixtures/contentobjects.php'
1090
        );
1091
1092
        $beforeCount = [
1093
            'all' => $this->countContentFields(),
1094
            'this' => $this->countContentFields(225),
1095
        ];
1096
1097
        $gateway = $this->getDatabaseGateway();
1098
        $gateway->deleteFields(225, 2);
1099
1100
        $this->assertEquals(
1101
            [
1102
                'all' => $beforeCount['all'] - 2,
1103
                'this' => $beforeCount['this'] - 2,
1104
            ],
1105
            [
1106
                'all' => $this->countContentFields(),
1107
                'this' => $this->countContentFields(225),
1108
            ]
1109
        );
1110
    }
1111
1112
    /**
1113
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteVersions
@@ 1115-1139 (lines=25) @@
1112
    /**
1113
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteVersions
1114
     */
1115
    public function testDeleteVersions()
1116
    {
1117
        $this->insertDatabaseFixture(
1118
            __DIR__ . '/../_fixtures/contentobjects.php'
1119
        );
1120
1121
        $beforeCount = [
1122
            'all' => $this->countContentVersions(),
1123
            'this' => $this->countContentVersions(14),
1124
        ];
1125
1126
        $gateway = $this->getDatabaseGateway();
1127
        $gateway->deleteVersions(14);
1128
1129
        $this->assertEquals(
1130
            [
1131
                'all' => $beforeCount['all'] - 2,
1132
                'this' => 0,
1133
            ],
1134
            [
1135
                'all' => $this->countContentVersions(),
1136
                'this' => $this->countContentVersions(14),
1137
            ]
1138
        );
1139
    }
1140
1141
    /**
1142
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteVersions
@@ 1144-1168 (lines=25) @@
1141
    /**
1142
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteVersions
1143
     */
1144
    public function testDeleteVersionsWithSecondArgument()
1145
    {
1146
        $this->insertDatabaseFixture(
1147
            __DIR__ . '/../_fixtures/contentobjects.php'
1148
        );
1149
1150
        $beforeCount = [
1151
            'all' => $this->countContentVersions(),
1152
            'this' => $this->countContentVersions(225),
1153
        ];
1154
1155
        $gateway = $this->getDatabaseGateway();
1156
        $gateway->deleteVersions(225, 2);
1157
1158
        $this->assertEquals(
1159
            [
1160
                'all' => $beforeCount['all'] - 1,
1161
                'this' => $beforeCount['this'] - 1,
1162
            ],
1163
            [
1164
                'all' => $this->countContentVersions(),
1165
                'this' => $this->countContentVersions(225),
1166
            ]
1167
        );
1168
    }
1169
1170
    /**
1171
     * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setName