Пример #1
0
 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);
 }
 /**
  * It should provide a Query object for a PHPCR query object.
  */
 public function testHandleCreateFromPhpcrQuery()
 {
     $locale = 'fr';
     $primarySelector = 'p';
     $this->queryCreateEvent->getInnerQuery()->willReturn($this->phpcrQuery->reveal());
     $this->queryCreateEvent->getLocale()->willReturn($locale);
     $this->queryCreateEvent->getOptions()->willReturn([]);
     $this->queryCreateEvent->getPrimarySelector()->willReturn($primarySelector);
     $this->queryManager->createQuery($this->phpcrQuery->reveal(), 'JCR-SQL2')->willReturn($this->phpcrQuery->reveal());
     $this->queryCreateEvent->setQuery(new Query($this->phpcrQuery->reveal(), $this->dispatcher->reveal(), $locale, [], $primarySelector))->shouldBeCalled();
     $this->subscriber->handleCreate($this->queryCreateEvent->reveal());
 }