protected function traverser()
 {
     $dom = new \DOMDocument('1.0');
     $dom->load($this->xml_file);
     $splos = new \SPLObjectStorage();
     $splos->attach($dom->documentElement);
     $traverser = new DOMTraverser($splos);
     return $traverser;
 }
 /**
  * Removes the specified validator.
  *
  * @param \F3\FLOW3\Validation\Validator\ValidatorInterface $validator The validator to remove
  * @author Robert Lemke <*****@*****.**>
  * @api
  */
 public function removeValidator(\F3\FLOW3\Validation\Validator\ValidatorInterface $validator)
 {
     if (!$this->validators->contains($validator)) {
         throw new \F3\FLOW3\Validation\Exception\NoSuchValidatorException('Cannot remove validator because its not in the conjunction.', 1207020177);
     }
     $this->validators->detach($validator);
 }
 /**
  * Replacing a new object which has not yet been persisted by another
  * new object will just replace them in the repository's list of added
  * objects.
  *
  * @test
  * @return void
  * @author Robert Lemke <*****@*****.**>
  */
 public function replaceNewObjectByNewObject()
 {
     $existingObject = new \stdClass();
     $newObject = new \stdClass();
     $addedObjects = new \SPLObjectStorage();
     $addedObjects->attach($existingObject);
     $mockPersistenceSession = $this->getMock('F3\\FLOW3\\Persistence\\Session', array(), array(), '', FALSE);
     $mockPersistenceManager = $this->getMock('F3\\FLOW3\\Persistence\\PersistenceManagerInterface');
     $mockPersistenceManager->expects($this->once())->method('getIdentifierByObject')->with($existingObject)->will($this->returnValue(NULL));
     $mockPersistenceManager->expects($this->once())->method('getSession')->will($this->returnValue($mockPersistenceSession));
     $repository = $this->getMock($this->buildAccessibleProxy('F3\\FLOW3\\Persistence\\Repository'), array('dummy'));
     $repository->injectPersistenceManager($mockPersistenceManager);
     $repository->_set('objectType', get_class($newObject));
     $repository->_set('addedObjects', $addedObjects);
     $repository->replace($existingObject, $newObject);
     $this->assertFalse($addedObjects->contains($existingObject));
     $this->assertTrue($addedObjects->contains($newObject));
 }
Ejemplo n.º 4
0
 /**
  * Provides :has pseudoclass.
  */
 protected function has($node, $selector)
 {
     $splos = new \SPLObjectStorage();
     $splos->attach($node);
     $traverser = new \QueryPath\CSS\DOMTraverser($splos, TRUE);
     $results = $traverser->find($selector)->matches();
     return count($results) > 0;
 }