eZ\Publish\Core\Persistence\Legacy\Tests\Content\Location\Gateway\DoctrineDatabaseTest::testGetMainNodeId PHP Method

testGetMainNodeId() public method

public testGetMainNodeId ( )
    public function testGetMainNodeId()
    {
        // $this->insertDatabaseFixture( __DIR__ . '/_fixtures/full_example_tree.php' );
        $handler = $this->getLocationGateway();
        $parentLocationData = array('node_id' => '77', 'depth' => '2', 'path_string' => '/1/2/77/');
        // main location
        $mainLocation = $handler->create(new CreateStruct(array('contentId' => 68, 'contentVersion' => 1, 'remoteId' => 'some_id', 'mainLocationId' => true)), $parentLocationData);
        // secondary location
        $handler->create(new CreateStruct(array('contentId' => 68, 'contentVersion' => 1, 'remoteId' => 'some_id', 'mainLocationId' => $mainLocation->id)), $parentLocationData);
        $handlerReflection = new \ReflectionObject($handler);
        $methodReflection = $handlerReflection->getMethod('getMainNodeId');
        $methodReflection->setAccessible(true);
        self::assertEquals($mainLocation->id, $res = $methodReflection->invoke($handler, 68));
    }