protected function createNode($id, $username) { $repository = $this->getMockBuilder('Jackalope\\Repository')->disableOriginalConstructor()->getMock(); $this->session->expects($this->any())->method('getRepository')->with()->will($this->returnValue($repository)); $nodeData = array("jcr:primaryType" => "rep:root", "jcr:system" => array(), 'username' => $username); return new Node($this->factory, $nodeData, $id, $this->session, $this->objectManager); }
public function testCommand() { $this->converter->expects($this->once())->method('convert')->with('Document\\MyClass', array('en'), array(), 'none')->will($this->returnValue(false)); $this->mockSession->expects($this->once())->method('save'); $this->commandTester->execute(array('classname' => 'Document\\MyClass', '--locales' => array('en'), '--force' => true)); $this->assertEquals('.' . PHP_EOL . 'done' . PHP_EOL, $this->commandTester->getDisplay()); }
public function setUp() { $this->factory = $this->getMock('Jackalope\\FactoryInterface'); $this->session = $this->getSessionMock(); $this->session->expects($this->any())->method('getNodes')->will($this->returnValue(array())); $this->session->expects($this->any())->method('getNodesByIdentifier')->will($this->returnValue(array())); $this->eventFilter = new EventFilter($this->factory, $this->session); }
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; }
public function setUp() { $this->session = $this->getMock('PHPCR\\SessionInterface'); $this->workspace = $this->getMock('PHPCR\\WorkspaceInterface'); $this->repository = $this->getMock('PHPCR\\RepositoryInterface'); $this->queryManager = $this->getMock('PHPCR\\Query\\QueryManagerInterface'); $this->row1 = $this->getMock('PHPCR\\Tests\\Stubs\\MockRow'); $this->node1 = $this->getMock('PHPCR\\Tests\\Stubs\\MockNode'); $this->dumperHelper = $this->getMockBuilder('PHPCR\\Util\\Console\\Helper\\PhpcrConsoleDumperHelper')->disableOriginalConstructor()->getMock(); $this->helperSet = new HelperSet(array('phpcr' => new PhpcrHelper($this->session), 'phpcr_console_dumper' => $this->dumperHelper)); $this->session->expects($this->any())->method('getWorkspace')->will($this->returnValue($this->workspace)); $this->workspace->expects($this->any())->method('getName')->will($this->returnValue('test')); $this->workspace->expects($this->any())->method('getQueryManager')->will($this->returnValue($this->queryManager)); $this->queryManager->expects($this->any())->method('getSupportedQueryLanguages')->will($this->returnValue(array('JCR-SQL2'))); $this->application = new Application(); $this->application->setHelperSet($this->helperSet); }