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