/** * Test to verify that eznode_assignment entres get removed. * * @link http://issues.ez.no/15478 */ public function testRemoveAssignments() { $db = eZDB::instance(); $testSet = array(); $folder = new ezpObject( "folder", 2 ); $folder->name = __FUNCTION__; $folder->publish(); $testSet[] = $folder; $childOne = new ezpObject( "folder", $folder->mainNode->node_id ); $childOne->name = "ChildOne"; $childOne->publish(); $testSet[] = $childOne; $childTwo = new ezpObject( "folder", $folder->mainNode->node_id ); $childTwo->name = "ChildTwo"; $childTwo->publish(); $testSet[] = $childTwo; $subChildOne = new ezpObject( 'article', $childOne->mainNode->node_id ); $subChildOne->title = "SubChild"; $subChildOne->publish(); $testSet[] = $subChildOne; $subChildTwo = new ezpObject( 'article', $childOne->mainNode->node_id ); $subChildTwo->title = "SubChildOther"; $subChildTwo->publish(); $testSet[] = $subChildTwo; $subChildThree = new ezpObject( 'article', $childOne->mainNode->node_id ); $subChildThree->title = "SubChildThird"; $subChildThree->publish(); $testSet[] = $subChildThree; // Let's add another placement here $newPlacementSubChildOne = $subChildOne->addNode( $childTwo->mainNode->node_id ); $testSet[] = $newPlacementSubChildOne; // $this->debugBasicNodeInfo( $testSet ); $coId = $newPlacementSubChildOne->attribute( 'contentobject_id' ); eZContentOperationCollection::removeAssignment( $childTwo->mainNode->node_id, $childTwo->id, array( $newPlacementSubChildOne ), false ); $checkSql = "SELECT * FROM eznode_assignment WHERE contentobject_id = {$coId}"; $result = $db->arrayQuery( $checkSql ); // After removing one of the assignments, the number of node // assignments for the content object should be only one. $numberOfAssignments = count( $result ); self::assertEquals( 1, $numberOfAssignments, "The number of node assignments are not correct, eznode_assignment table not cleaned up correctly." ); }