コード例 #1
0
 public function testUpdate()
 {
     $nodeType = $this->getMock('PHPCR\\NodeType\\NodeTypeInterface');
     $nodeType->expects($this->once())->method('getName')->will($this->returnValue('nt:unstructured'));
     $this->session->expects($this->exactly(1))->method('getNode')->with('/cms')->will($this->returnValue($this->node1));
     $this->node1->expects($this->once())->method('getPrimaryNodeType')->will($this->returnValue($nodeType));
     $me = $this;
     $this->phpcrHelper->expects($this->once())->method('processNode')->will($this->returnCallback(function ($output, $node, $options) use($me) {
         $me->assertEquals($me->node1, $node);
         $me->assertEquals(array('setProp' => array('foo=bar'), 'removeProp' => array('bar'), 'addMixins' => array('foo:bar'), 'removeMixins' => array('bar:foo'), 'dump' => true), $options);
     }));
     $this->executeCommand('phpcr:node:touch', array('path' => '/cms', '--set-prop' => array('foo=bar'), '--remove-prop' => array('bar'), '--add-mixin' => array('foo:bar'), '--remove-mixin' => array('bar:foo'), '--dump' => true));
 }
コード例 #2
0
 /**
  * Constructor
  *
  * @param SessionInterface         $session
  * @param DocumentManagerInterface $dm
  */
 public function __construct(SessionInterface $session = null, DocumentManagerInterface $dm = null)
 {
     if (!$session && $dm) {
         $session = $dm->getPhpcrSession();
     }
     parent::__construct($session);
     $this->dm = $dm;
 }