Doctrine\Tests\ODM\PHPCR\UnitOfWorkTest::createNode PHP Метод

createNode() защищенный Метод

protected createNode ( $id, $username, $primaryType = 'rep:root' )
    protected function createNode($id, $username, $primaryType = 'rep:root')
    {
        $repository = $this->getMockBuilder('Jackalope\\Repository')->disableOriginalConstructor()->getMock();
        $this->session->expects($this->any())->method('getRepository')->with()->will($this->returnValue($repository));
        $type = $this->getMockBuilder('Jackalope\\NodeType\\NodeType')->disableOriginalConstructor()->getMock();
        $type->expects($this->any())->method('getName')->with()->will($this->returnValue($primaryType));
        $ntm = $this->getMockBuilder('Jackalope\\NodeType\\NodeTypeManager')->disableOriginalConstructor()->getMock();
        $ntm->expects($this->any())->method('getNodeType')->with()->will($this->returnValue($type));
        $workspace = $this->getMockBuilder('Jackalope\\Workspace')->disableOriginalConstructor()->getMock();
        $workspace->expects($this->any())->method('getNodeTypeManager')->with()->will($this->returnValue($ntm));
        $this->session->expects($this->any())->method('getWorkspace')->with()->will($this->returnValue($workspace));
        $this->session->expects($this->any())->method('nodeExists')->with($id)->will($this->returnValue(true));
        $nodeData = array("jcr:primaryType" => $primaryType, "jcr:system" => array(), 'username' => $username);
        $node = new Node($this->factory, $nodeData, $id, $this->session, $this->objectManager);
        $this->session->expects($this->any())->method('getNode')->with($id)->will($this->returnValue($node));
        return $node;
    }