| @@ 760-794 (lines=35) @@ | ||
| 757 | * @depends testCreateLocation |
|
| 758 | * @dataProvider getNodeAssignmentValues |
|
| 759 | */ |
|
| 760 | public function testCreateLocationNodeAssignmentCreation($field, $value) |
|
| 761 | { |
|
| 762 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 763 | $handler = $this->getLocationGateway(); |
|
| 764 | $handler->createNodeAssignment( |
|
| 765 | new CreateStruct( |
|
| 766 | array( |
|
| 767 | 'contentId' => 68, |
|
| 768 | 'contentVersion' => 1, |
|
| 769 | 'mainLocationId' => 1, |
|
| 770 | 'priority' => 1, |
|
| 771 | 'remoteId' => 'some_id', |
|
| 772 | 'sortField' => 2, |
|
| 773 | 'sortOrder' => 0, |
|
| 774 | 'hidden' => 1, |
|
| 775 | ) |
|
| 776 | ), |
|
| 777 | '77', |
|
| 778 | DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE |
|
| 779 | ); |
|
| 780 | ||
| 781 | $query = $this->handler->createSelectQuery(); |
|
| 782 | $this->assertQueryResult( |
|
| 783 | array(array($value)), |
|
| 784 | $query |
|
| 785 | ->select($field) |
|
| 786 | ->from('eznode_assignment') |
|
| 787 | ->where( |
|
| 788 | $query->expr->lAnd( |
|
| 789 | $query->expr->eq('contentobject_id', 68), |
|
| 790 | $query->expr->eq('parent_node', 77) |
|
| 791 | ) |
|
| 792 | ) |
|
| 793 | ); |
|
| 794 | } |
|
| 795 | ||
| 796 | /** |
|
| 797 | * @depends testCreateLocation |
|
| @@ 799-832 (lines=34) @@ | ||
| 796 | /** |
|
| 797 | * @depends testCreateLocation |
|
| 798 | */ |
|
| 799 | public function testCreateLocationNodeAssignmentCreationMainLocation() |
|
| 800 | { |
|
| 801 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 802 | $handler = $this->getLocationGateway(); |
|
| 803 | $handler->createNodeAssignment( |
|
| 804 | new CreateStruct( |
|
| 805 | array( |
|
| 806 | 'contentId' => 68, |
|
| 807 | 'contentVersion' => 1, |
|
| 808 | 'mainLocationId' => true, |
|
| 809 | 'priority' => 1, |
|
| 810 | 'remoteId' => 'some_id', |
|
| 811 | 'sortField' => 1, |
|
| 812 | 'sortOrder' => 1, |
|
| 813 | ) |
|
| 814 | ), |
|
| 815 | '77', |
|
| 816 | DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE |
|
| 817 | ); |
|
| 818 | ||
| 819 | $query = $this->handler->createSelectQuery(); |
|
| 820 | $this->assertQueryResult( |
|
| 821 | array(array(1)), |
|
| 822 | $query |
|
| 823 | ->select('is_main') |
|
| 824 | ->from('eznode_assignment') |
|
| 825 | ->where( |
|
| 826 | $query->expr->lAnd( |
|
| 827 | $query->expr->eq('contentobject_id', 68), |
|
| 828 | $query->expr->eq('parent_node', 77) |
|
| 829 | ) |
|
| 830 | ) |
|
| 831 | ); |
|
| 832 | } |
|
| 833 | ||
| 834 | /** |
|
| 835 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::updateLocationsContentVersionNo |
|
| @@ 1153-1189 (lines=37) @@ | ||
| 1150 | /** |
|
| 1151 | * @depends testCreateLocationNodeAssignmentCreation |
|
| 1152 | */ |
|
| 1153 | public function testConvertNodeAssignmentsUpdateAssignment() |
|
| 1154 | { |
|
| 1155 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 1156 | ||
| 1157 | $handler = $this->getLocationGateway(); |
|
| 1158 | $handler->createNodeAssignment( |
|
| 1159 | new CreateStruct( |
|
| 1160 | array( |
|
| 1161 | 'contentId' => 68, |
|
| 1162 | 'contentVersion' => 1, |
|
| 1163 | 'mainLocationId' => 1, |
|
| 1164 | 'priority' => 1, |
|
| 1165 | 'remoteId' => 'some_id', |
|
| 1166 | 'sortField' => 1, |
|
| 1167 | 'sortOrder' => 1, |
|
| 1168 | ) |
|
| 1169 | ), |
|
| 1170 | '77', |
|
| 1171 | DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE |
|
| 1172 | ); |
|
| 1173 | ||
| 1174 | $handler->createLocationsFromNodeAssignments(68, 1); |
|
| 1175 | ||
| 1176 | $query = $this->handler->createSelectQuery(); |
|
| 1177 | $this->assertQueryResult( |
|
| 1178 | array(array(DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP)), |
|
| 1179 | $query |
|
| 1180 | ->select('op_code') |
|
| 1181 | ->from('eznode_assignment') |
|
| 1182 | ->where( |
|
| 1183 | $query->expr->lAnd( |
|
| 1184 | $query->expr->eq('contentobject_id', 68), |
|
| 1185 | $query->expr->eq('parent_node', 77) |
|
| 1186 | ) |
|
| 1187 | ) |
|
| 1188 | ); |
|
| 1189 | } |
|
| 1190 | ||
| 1191 | /** |
|
| 1192 | * Test for the setSectionForSubtree() method. |
|