| @@ 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 | { |
|
| @@ 1099-1118 (lines=20) @@ | ||
| 1096 | /** |
|
| 1097 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteFieldDefinitionsForType |
|
| 1098 | */ |
|
| 1099 | public function testDeleteFieldDefinitionsForTypeNotExisting() |
|
| 1100 | { |
|
| 1101 | $this->insertDatabaseFixture( |
|
| 1102 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1103 | ); |
|
| 1104 | ||
| 1105 | $gateway = $this->getGateway(); |
|
| 1106 | ||
| 1107 | $gateway->deleteFieldDefinitionsForType(23, 1); |
|
| 1108 | ||
| 1109 | $countNotAffectedAttr = $this->getDatabaseHandler() |
|
| 1110 | ->createSelectQuery(); |
|
| 1111 | $countNotAffectedAttr->select('COUNT(*)') |
|
| 1112 | ->from('ezcontentclass_attribute'); |
|
| 1113 | ||
| 1114 | $this->assertQueryResult( |
|
| 1115 | [[5]], |
|
| 1116 | $countNotAffectedAttr |
|
| 1117 | ); |
|
| 1118 | } |
|
| 1119 | ||
| 1120 | /** |
|
| 1121 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| @@ 1123-1142 (lines=20) @@ | ||
| 1120 | /** |
|
| 1121 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| 1122 | */ |
|
| 1123 | public function testDeleteGroupAssignmentsForTypeExisting() |
|
| 1124 | { |
|
| 1125 | $this->insertDatabaseFixture( |
|
| 1126 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1127 | ); |
|
| 1128 | ||
| 1129 | $gateway = $this->getGateway(); |
|
| 1130 | ||
| 1131 | $gateway->deleteGroupAssignmentsForType(1, 0); |
|
| 1132 | ||
| 1133 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1134 | ->createSelectQuery(); |
|
| 1135 | $countAffectedAttr->select('COUNT(*)') |
|
| 1136 | ->from('ezcontentclass_classgroup'); |
|
| 1137 | ||
| 1138 | $this->assertQueryResult( |
|
| 1139 | [[2]], |
|
| 1140 | $countAffectedAttr |
|
| 1141 | ); |
|
| 1142 | } |
|
| 1143 | ||
| 1144 | /** |
|
| 1145 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| @@ 1147-1166 (lines=20) @@ | ||
| 1144 | /** |
|
| 1145 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteGroupAssignmentsForType |
|
| 1146 | */ |
|
| 1147 | public function testDeleteGroupAssignmentsForTypeNotExisting() |
|
| 1148 | { |
|
| 1149 | $this->insertDatabaseFixture( |
|
| 1150 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1151 | ); |
|
| 1152 | ||
| 1153 | $gateway = $this->getGateway(); |
|
| 1154 | ||
| 1155 | $gateway->deleteType(23, 1); |
|
| 1156 | ||
| 1157 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1158 | ->createSelectQuery(); |
|
| 1159 | $countAffectedAttr->select('COUNT(*)') |
|
| 1160 | ->from('ezcontentclass_classgroup'); |
|
| 1161 | ||
| 1162 | $this->assertQueryResult( |
|
| 1163 | [[3]], |
|
| 1164 | $countAffectedAttr |
|
| 1165 | ); |
|
| 1166 | } |
|
| 1167 | ||
| 1168 | /** |
|
| 1169 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| @@ 1171-1190 (lines=20) @@ | ||
| 1168 | /** |
|
| 1169 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| 1170 | */ |
|
| 1171 | public function testDeleteTypeExisting() |
|
| 1172 | { |
|
| 1173 | $this->insertDatabaseFixture( |
|
| 1174 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1175 | ); |
|
| 1176 | ||
| 1177 | $gateway = $this->getGateway(); |
|
| 1178 | ||
| 1179 | $gateway->deleteType(1, 0); |
|
| 1180 | ||
| 1181 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1182 | ->createSelectQuery(); |
|
| 1183 | $countAffectedAttr->select('COUNT(*)') |
|
| 1184 | ->from('ezcontentclass'); |
|
| 1185 | ||
| 1186 | $this->assertQueryResult( |
|
| 1187 | [[1]], |
|
| 1188 | $countAffectedAttr |
|
| 1189 | ); |
|
| 1190 | } |
|
| 1191 | ||
| 1192 | /** |
|
| 1193 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| @@ 1195-1214 (lines=20) @@ | ||
| 1192 | /** |
|
| 1193 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::deleteType |
|
| 1194 | */ |
|
| 1195 | public function testDeleteTypeNotExisting() |
|
| 1196 | { |
|
| 1197 | $this->insertDatabaseFixture( |
|
| 1198 | __DIR__ . '/_fixtures/existing_types.php' |
|
| 1199 | ); |
|
| 1200 | ||
| 1201 | $gateway = $this->getGateway(); |
|
| 1202 | ||
| 1203 | $gateway->deleteType(23, 1); |
|
| 1204 | ||
| 1205 | $countAffectedAttr = $this->getDatabaseHandler() |
|
| 1206 | ->createSelectQuery(); |
|
| 1207 | $countAffectedAttr->select('COUNT(*)') |
|
| 1208 | ->from('ezcontentclass'); |
|
| 1209 | ||
| 1210 | $this->assertQueryResult( |
|
| 1211 | [[2]], |
|
| 1212 | $countAffectedAttr |
|
| 1213 | ); |
|
| 1214 | } |
|
| 1215 | ||
| 1216 | /** |
|
| 1217 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::publishTypeAndFields |
|