public function testBuildForm()
 {
     $test = $this;
     $this->reg->expects($this->once())->method('getManager')->with(null)->will($this->returnValue($this->dm));
     $this->builder->expects($this->once())->method('addModelTransformer')->will($this->returnCallback(function ($transformer) use($test) {
         $test->assertInstanceOf('Doctrine\\Bundle\\PHPCRBundle\\Form\\DataTransformer\\DocumentToPathTransformer', $transformer);
         return;
     }));
     $this->type->buildForm($this->builder, array('manager_name' => null));
 }
 /**
  * Create the guesser for this test.
  *
  * @return GuesserInterface
  */
 protected function createGuesser()
 {
     $this->registry = $this->getMockBuilder('\\Doctrine\\Bundle\\PHPCRBundle\\ManagerRegistry')->disableOriginalConstructor()->getMock();
     $this->manager = $this->getMockBuilder('\\Doctrine\\ODM\\PHPCR\\DocumentManager')->disableOriginalConstructor()->getMock();
     $this->metadata = $this->getMockBuilder('\\Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock();
     $this->registry->expects($this->any())->method('getManagerForClass')->with($this->equalTo('Symfony\\Cmf\\Bundle\\SeoBundle\\Tests\\Unit\\Sitemap\\LastModifiedGuesserTest'))->will($this->returnValue($this->manager));
     $this->manager->expects($this->any())->method('getClassMetadata')->with($this->equalTo('Symfony\\Cmf\\Bundle\\SeoBundle\\Tests\\Unit\\Sitemap\\LastModifiedGuesserTest'))->will($this->returnValue($this->metadata));
     $this->metadata->expects($this->any())->method('getMixins')->will($this->returnValue(array('mix:lastModified')));
     $this->metadata->expects($this->any())->method('getFieldNames')->will($this->returnValue(array('lastModified')));
     $this->metadata->expects($this->any())->method('getFieldMapping')->with($this->equalTo('lastModified'))->will($this->returnValue(array('property' => 'jcr:lastModified')));
     $this->metadata->expects($this->any())->method('getFieldValue')->with($this->equalTo($this), $this->equalTo('lastModified'))->will($this->returnValue(new \DateTime('2016-07-06', new \DateTimeZone('Europe/Berlin'))));
     return new LastModifiedGuesser($this->registry);
 }
 public function testRootEdgeCase()
 {
     $this->buildMocks('/');
     $this->managerRegistry->expects($this->any())->method('getManagerForClass')->with(get_class($this->object))->will($this->returnValue($this->documentManager));
     $this->documentManager->expects($this->any())->method('getNodeForDocument')->with($this->object)->willReturn($this->node);
     $this->node->expects($this->any())->method('getDepth')->will($this->returnValue(4));
     $urlInformation = new UrlInformation();
     $this->guesser->guessValues($urlInformation, $this->object, 'default');
     $this->assertEquals(3, $urlInformation->getDepth());
 }