| @@ 727-761 (lines=35) @@ | ||
| 724 | * @depends testCreateLocation |
|
| 725 | * @dataProvider getNodeAssignmentValues |
|
| 726 | */ |
|
| 727 | public function testCreateLocationNodeAssignmentCreation($field, $value) |
|
| 728 | { |
|
| 729 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 730 | $handler = $this->getLocationGateway(); |
|
| 731 | $handler->createNodeAssignment( |
|
| 732 | new CreateStruct( |
|
| 733 | array( |
|
| 734 | 'contentId' => 68, |
|
| 735 | 'contentVersion' => 1, |
|
| 736 | 'mainLocationId' => 1, |
|
| 737 | 'priority' => 1, |
|
| 738 | 'remoteId' => 'some_id', |
|
| 739 | 'sortField' => 2, |
|
| 740 | 'sortOrder' => 0, |
|
| 741 | 'hidden' => 1, |
|
| 742 | ) |
|
| 743 | ), |
|
| 744 | '77', |
|
| 745 | DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE |
|
| 746 | ); |
|
| 747 | ||
| 748 | $query = $this->handler->createSelectQuery(); |
|
| 749 | $this->assertQueryResult( |
|
| 750 | array(array($value)), |
|
| 751 | $query |
|
| 752 | ->select($field) |
|
| 753 | ->from('eznode_assignment') |
|
| 754 | ->where( |
|
| 755 | $query->expr->lAnd( |
|
| 756 | $query->expr->eq('contentobject_id', 68), |
|
| 757 | $query->expr->eq('parent_node', 77) |
|
| 758 | ) |
|
| 759 | ) |
|
| 760 | ); |
|
| 761 | } |
|
| 762 | ||
| 763 | /** |
|
| 764 | * @depends testCreateLocation |
|
| @@ 766-799 (lines=34) @@ | ||
| 763 | /** |
|
| 764 | * @depends testCreateLocation |
|
| 765 | */ |
|
| 766 | public function testCreateLocationNodeAssignmentCreationMainLocation() |
|
| 767 | { |
|
| 768 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 769 | $handler = $this->getLocationGateway(); |
|
| 770 | $handler->createNodeAssignment( |
|
| 771 | new CreateStruct( |
|
| 772 | array( |
|
| 773 | 'contentId' => 68, |
|
| 774 | 'contentVersion' => 1, |
|
| 775 | 'mainLocationId' => true, |
|
| 776 | 'priority' => 1, |
|
| 777 | 'remoteId' => 'some_id', |
|
| 778 | 'sortField' => 1, |
|
| 779 | 'sortOrder' => 1, |
|
| 780 | ) |
|
| 781 | ), |
|
| 782 | '77', |
|
| 783 | DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE |
|
| 784 | ); |
|
| 785 | ||
| 786 | $query = $this->handler->createSelectQuery(); |
|
| 787 | $this->assertQueryResult( |
|
| 788 | array(array(1)), |
|
| 789 | $query |
|
| 790 | ->select('is_main') |
|
| 791 | ->from('eznode_assignment') |
|
| 792 | ->where( |
|
| 793 | $query->expr->lAnd( |
|
| 794 | $query->expr->eq('contentobject_id', 68), |
|
| 795 | $query->expr->eq('parent_node', 77) |
|
| 796 | ) |
|
| 797 | ) |
|
| 798 | ); |
|
| 799 | } |
|
| 800 | ||
| 801 | /** |
|
| 802 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway\DoctrineDatabase::updateLocationsContentVersionNo |
|
| @@ 1120-1156 (lines=37) @@ | ||
| 1117 | /** |
|
| 1118 | * @depends testCreateLocationNodeAssignmentCreation |
|
| 1119 | */ |
|
| 1120 | public function testConvertNodeAssignmentsUpdateAssignment() |
|
| 1121 | { |
|
| 1122 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); |
|
| 1123 | ||
| 1124 | $handler = $this->getLocationGateway(); |
|
| 1125 | $handler->createNodeAssignment( |
|
| 1126 | new CreateStruct( |
|
| 1127 | array( |
|
| 1128 | 'contentId' => 68, |
|
| 1129 | 'contentVersion' => 1, |
|
| 1130 | 'mainLocationId' => 1, |
|
| 1131 | 'priority' => 1, |
|
| 1132 | 'remoteId' => 'some_id', |
|
| 1133 | 'sortField' => 1, |
|
| 1134 | 'sortOrder' => 1, |
|
| 1135 | ) |
|
| 1136 | ), |
|
| 1137 | '77', |
|
| 1138 | DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE |
|
| 1139 | ); |
|
| 1140 | ||
| 1141 | $handler->createLocationsFromNodeAssignments(68, 1); |
|
| 1142 | ||
| 1143 | $query = $this->handler->createSelectQuery(); |
|
| 1144 | $this->assertQueryResult( |
|
| 1145 | array(array(DoctrineDatabase::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP)), |
|
| 1146 | $query |
|
| 1147 | ->select('op_code') |
|
| 1148 | ->from('eznode_assignment') |
|
| 1149 | ->where( |
|
| 1150 | $query->expr->lAnd( |
|
| 1151 | $query->expr->eq('contentobject_id', 68), |
|
| 1152 | $query->expr->eq('parent_node', 77) |
|
| 1153 | ) |
|
| 1154 | ) |
|
| 1155 | ); |
|
| 1156 | } |
|
| 1157 | ||
| 1158 | /** |
|
| 1159 | * Test for the setSectionForSubtree() method. |
|