| @@ 60-75 (lines=16) @@ | ||
| 57 | /** |
|
| 58 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::trashLocation |
|
| 59 | */ |
|
| 60 | public function testTrashLocationUpdateTrashTable() |
|
| 61 | { |
|
| 62 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 63 | $handler = $this->getLocationGateway(); |
|
| 64 | $handler->trashLocation(71); |
|
| 65 | ||
| 66 | $query = $this->handler->createSelectQuery(); |
|
| 67 | $this->assertQueryResult( |
|
| 68 | [ |
|
| 69 | [71, '/1/2/69/70/71/'], |
|
| 70 | ], |
|
| 71 | $query |
|
| 72 | ->select('node_id', 'path_string') |
|
| 73 | ->from('ezcontentobject_trash') |
|
| 74 | ); |
|
| 75 | } |
|
| 76 | ||
| 77 | public static function getUntrashedLocationValues() |
|
| 78 | { |
|
| @@ 1114-1133 (lines=20) @@ | ||
| 1111 | /** |
|
| 1112 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteFieldDefinitionsForType |
|
| 1113 | */ |
|
| 1114 | public function testDeleteFieldDefinitionsForTypeNotExisting() |
|
| 1115 | { |
|
| 1116 | $this->insertDatabaseFixture( |
|
| 1117 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1118 | ); |
|
| 1119 | ||
| 1120 | $gateway = $this->getGateway(); |
|
| 1121 | ||
| 1122 | $gateway->deleteFieldDefinitionsForType(23, 1); |
|
| 1123 | ||
| 1124 | $countNotAffectedAttr = $this->getDatabaseHandler() |
|
| 1125 | ->createSelectQuery(); |
|
| 1126 | $countNotAffectedAttr->select('COUNT(*)') |
|
| 1127 | ->from('ezcontentclass_attribute'); |
|
| 1128 | ||
| 1129 | $this->assertQueryResult( |
|
| 1130 | [[7]], |
|
| 1131 | $countNotAffectedAttr |
|
| 1132 | ); |
|
| 1133 | } |
|
| 1134 | ||
| 1135 | /** |
|
| 1136 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| @@ 1138-1157 (lines=20) @@ | ||
| 1135 | /** |
|
| 1136 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| 1137 | */ |
|
| 1138 | public function testDeleteGroupAssignmentsForTypeExisting() |
|
| 1139 | { |
|
| 1140 | $this->insertDatabaseFixture( |
|
| 1141 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1142 | ); |
|
| 1143 | ||
| 1144 | $gateway = $this->getGateway(); |
|
| 1145 | ||
| 1146 | $gateway->deleteGroupAssignmentsForType(1, 0); |
|
| 1147 | ||
| 1148 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1149 | ->createSelectQuery(); |
|
| 1150 | $countAffectedAttr->select('COUNT(*)') |
|
| 1151 | ->from('ezcontentclass_classgroup'); |
|
| 1152 | ||
| 1153 | $this->assertQueryResult( |
|
| 1154 | [[2]], |
|
| 1155 | $countAffectedAttr |
|
| 1156 | ); |
|
| 1157 | } |
|
| 1158 | ||
| 1159 | /** |
|
| 1160 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| @@ 1162-1181 (lines=20) @@ | ||
| 1159 | /** |
|
| 1160 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| 1161 | */ |
|
| 1162 | public function testDeleteGroupAssignmentsForTypeNotExisting() |
|
| 1163 | { |
|
| 1164 | $this->insertDatabaseFixture( |
|
| 1165 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1166 | ); |
|
| 1167 | ||
| 1168 | $gateway = $this->getGateway(); |
|
| 1169 | ||
| 1170 | $gateway->deleteType(23, 1); |
|
| 1171 | ||
| 1172 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1173 | ->createSelectQuery(); |
|
| 1174 | $countAffectedAttr->select('COUNT(*)') |
|
| 1175 | ->from('ezcontentclass_classgroup'); |
|
| 1176 | ||
| 1177 | $this->assertQueryResult( |
|
| 1178 | [[3]], |
|
| 1179 | $countAffectedAttr |
|
| 1180 | ); |
|
| 1181 | } |
|
| 1182 | ||
| 1183 | /** |
|
| 1184 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| @@ 1186-1205 (lines=20) @@ | ||
| 1183 | /** |
|
| 1184 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| 1185 | */ |
|
| 1186 | public function testDeleteTypeExisting() |
|
| 1187 | { |
|
| 1188 | $this->insertDatabaseFixture( |
|
| 1189 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1190 | ); |
|
| 1191 | ||
| 1192 | $gateway = $this->getGateway(); |
|
| 1193 | ||
| 1194 | $gateway->deleteType(1, 0); |
|
| 1195 | ||
| 1196 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1197 | ->createSelectQuery(); |
|
| 1198 | $countAffectedAttr->select('COUNT(*)') |
|
| 1199 | ->from('ezcontentclass'); |
|
| 1200 | ||
| 1201 | $this->assertQueryResult( |
|
| 1202 | [[1]], |
|
| 1203 | $countAffectedAttr |
|
| 1204 | ); |
|
| 1205 | } |
|
| 1206 | ||
| 1207 | /** |
|
| 1208 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| @@ 1210-1229 (lines=20) @@ | ||
| 1207 | /** |
|
| 1208 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| 1209 | */ |
|
| 1210 | public function testDeleteTypeNotExisting() |
|
| 1211 | { |
|
| 1212 | $this->insertDatabaseFixture( |
|
| 1213 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1214 | ); |
|
| 1215 | ||
| 1216 | $gateway = $this->getGateway(); |
|
| 1217 | ||
| 1218 | $gateway->deleteType(23, 1); |
|
| 1219 | ||
| 1220 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1221 | ->createSelectQuery(); |
|
| 1222 | $countAffectedAttr->select('COUNT(*)') |
|
| 1223 | ->from('ezcontentclass'); |
|
| 1224 | ||
| 1225 | $this->assertQueryResult( |
|
| 1226 | [[2]], |
|
| 1227 | $countAffectedAttr |
|
| 1228 | ); |
|
| 1229 | } |
|
| 1230 | ||
| 1231 | /** |
|
| 1232 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::publishTypeAndFields |
|