| @@ 1086-1110 (lines=25) @@ | ||
| 1083 | /** |
|
| 1084 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteFields |
|
| 1085 | */ |
|
| 1086 | public function testDeleteFields() |
|
| 1087 | { |
|
| 1088 | $this->insertDatabaseFixture( |
|
| 1089 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1090 | ); |
|
| 1091 | ||
| 1092 | $beforeCount = array( |
|
| 1093 | 'all' => $this->countContentFields(), |
|
| 1094 | 'this' => $this->countContentFields(4), |
|
| 1095 | ); |
|
| 1096 | ||
| 1097 | $gateway = $this->getDatabaseGateway(); |
|
| 1098 | $gateway->deleteFields(4); |
|
| 1099 | ||
| 1100 | $this->assertEquals( |
|
| 1101 | array( |
|
| 1102 | 'all' => $beforeCount['all'] - 2, |
|
| 1103 | 'this' => 0, |
|
| 1104 | ), |
|
| 1105 | array( |
|
| 1106 | 'all' => $this->countContentFields(), |
|
| 1107 | 'this' => $this->countContentFields(4), |
|
| 1108 | ) |
|
| 1109 | ); |
|
| 1110 | } |
|
| 1111 | ||
| 1112 | /** |
|
| 1113 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteFields |
|
| @@ 1115-1139 (lines=25) @@ | ||
| 1112 | /** |
|
| 1113 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteFields |
|
| 1114 | */ |
|
| 1115 | public function testDeleteFieldsWithSecondArgument() |
|
| 1116 | { |
|
| 1117 | $this->insertDatabaseFixture( |
|
| 1118 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1119 | ); |
|
| 1120 | ||
| 1121 | $beforeCount = array( |
|
| 1122 | 'all' => $this->countContentFields(), |
|
| 1123 | 'this' => $this->countContentFields(225), |
|
| 1124 | ); |
|
| 1125 | ||
| 1126 | $gateway = $this->getDatabaseGateway(); |
|
| 1127 | $gateway->deleteFields(225, 2); |
|
| 1128 | ||
| 1129 | $this->assertEquals( |
|
| 1130 | array( |
|
| 1131 | 'all' => $beforeCount['all'] - 2, |
|
| 1132 | 'this' => $beforeCount['this'] - 2, |
|
| 1133 | ), |
|
| 1134 | array( |
|
| 1135 | 'all' => $this->countContentFields(), |
|
| 1136 | 'this' => $this->countContentFields(225), |
|
| 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 testDeleteVersions() |
|
| 1145 | { |
|
| 1146 | $this->insertDatabaseFixture( |
|
| 1147 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1148 | ); |
|
| 1149 | ||
| 1150 | $beforeCount = array( |
|
| 1151 | 'all' => $this->countContentVersions(), |
|
| 1152 | 'this' => $this->countContentVersions(14), |
|
| 1153 | ); |
|
| 1154 | ||
| 1155 | $gateway = $this->getDatabaseGateway(); |
|
| 1156 | $gateway->deleteVersions(14); |
|
| 1157 | ||
| 1158 | $this->assertEquals( |
|
| 1159 | array( |
|
| 1160 | 'all' => $beforeCount['all'] - 2, |
|
| 1161 | 'this' => 0, |
|
| 1162 | ), |
|
| 1163 | array( |
|
| 1164 | 'all' => $this->countContentVersions(), |
|
| 1165 | 'this' => $this->countContentVersions(14), |
|
| 1166 | ) |
|
| 1167 | ); |
|
| 1168 | } |
|
| 1169 | ||
| 1170 | /** |
|
| 1171 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteVersions |
|
| @@ 1173-1197 (lines=25) @@ | ||
| 1170 | /** |
|
| 1171 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteVersions |
|
| 1172 | */ |
|
| 1173 | public function testDeleteVersionsWithSecondArgument() |
|
| 1174 | { |
|
| 1175 | $this->insertDatabaseFixture( |
|
| 1176 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1177 | ); |
|
| 1178 | ||
| 1179 | $beforeCount = array( |
|
| 1180 | 'all' => $this->countContentVersions(), |
|
| 1181 | 'this' => $this->countContentVersions(225), |
|
| 1182 | ); |
|
| 1183 | ||
| 1184 | $gateway = $this->getDatabaseGateway(); |
|
| 1185 | $gateway->deleteVersions(225, 2); |
|
| 1186 | ||
| 1187 | $this->assertEquals( |
|
| 1188 | array( |
|
| 1189 | 'all' => $beforeCount['all'] - 1, |
|
| 1190 | 'this' => $beforeCount['this'] - 1, |
|
| 1191 | ), |
|
| 1192 | array( |
|
| 1193 | 'all' => $this->countContentVersions(), |
|
| 1194 | 'this' => $this->countContentVersions(225), |
|
| 1195 | ) |
|
| 1196 | ); |
|
| 1197 | } |
|
| 1198 | ||
| 1199 | /** |
|
| 1200 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setName |
|
| @@ 1230-1254 (lines=25) @@ | ||
| 1227 | /** |
|
| 1228 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteNames |
|
| 1229 | */ |
|
| 1230 | public function testDeleteNames() |
|
| 1231 | { |
|
| 1232 | $this->insertDatabaseFixture( |
|
| 1233 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1234 | ); |
|
| 1235 | ||
| 1236 | $beforeCount = array( |
|
| 1237 | 'all' => $this->countContentNames(), |
|
| 1238 | 'this' => $this->countContentNames(14), |
|
| 1239 | ); |
|
| 1240 | ||
| 1241 | $gateway = $this->getDatabaseGateway(); |
|
| 1242 | $gateway->deleteNames(14); |
|
| 1243 | ||
| 1244 | $this->assertEquals( |
|
| 1245 | array( |
|
| 1246 | 'all' => $beforeCount['all'] - 2, |
|
| 1247 | 'this' => 0, |
|
| 1248 | ), |
|
| 1249 | array( |
|
| 1250 | 'all' => $this->countContentNames(), |
|
| 1251 | 'this' => $this->countContentNames(14), |
|
| 1252 | ) |
|
| 1253 | ); |
|
| 1254 | } |
|
| 1255 | ||
| 1256 | /** |
|
| 1257 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteNames |
|
| @@ 1259-1283 (lines=25) @@ | ||
| 1256 | /** |
|
| 1257 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteNames |
|
| 1258 | */ |
|
| 1259 | public function testDeleteNamesWithSecondArgument() |
|
| 1260 | { |
|
| 1261 | $this->insertDatabaseFixture( |
|
| 1262 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1263 | ); |
|
| 1264 | ||
| 1265 | $beforeCount = array( |
|
| 1266 | 'all' => $this->countContentNames(), |
|
| 1267 | 'this' => $this->countContentNames(225), |
|
| 1268 | ); |
|
| 1269 | ||
| 1270 | $gateway = $this->getDatabaseGateway(); |
|
| 1271 | $gateway->deleteNames(225, 2); |
|
| 1272 | ||
| 1273 | $this->assertEquals( |
|
| 1274 | array( |
|
| 1275 | 'all' => $beforeCount['all'] - 1, |
|
| 1276 | 'this' => $beforeCount['this'] - 1, |
|
| 1277 | ), |
|
| 1278 | array( |
|
| 1279 | 'all' => $this->countContentNames(), |
|
| 1280 | 'this' => $this->countContentNames(225), |
|
| 1281 | ) |
|
| 1282 | ); |
|
| 1283 | } |
|
| 1284 | ||
| 1285 | /** |
|
| 1286 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteContent |
|