Ejemplo n.º 1
0
 public function testDataClassCreationForNonPhpcr()
 {
     $this->validator->expects($this->any())->method('validate')->will($this->returnValue(array()));
     $formData = array('title' => 'Title', 'originalUrl' => 'original/url', 'extraProperties' => array(), 'extraNames' => array(), 'extraHttp' => array());
     $form = $this->factory->create(SeoMetadataTypeTest_OrmType::class);
     $this->assertFalse($form->getConfig()->getByReference());
     $object = new SeoMetadataModel();
     $object->setTitle($formData['title']);
     $object->setOriginalUrl($formData['originalUrl']);
     $object->setExtraNames($formData['extraNames']);
     $object->setExtraHttp($formData['extraHttp']);
     $object->setExtraProperties($formData['extraProperties']);
     // submit the data to the form directly
     $form->submit($formData);
     $this->assertTrue($form->isSynchronized());
     $this->assertEquals($object, $form->getData());
 }
 public function testValidSeoChannelContent()
 {
     $title = 'Title';
     $description = 'Lorem ipsum dolor sit amet..';
     $url = 'http://lorem.ipsum';
     $seoMetadata = new SeoMetadata();
     $seoMetadata->setTitle($title);
     $seoMetadata->setMetaDescription($description);
     $seoMetadata->setOriginalUrl($url);
     $seoAware = $this->getMock('Symfony\\Cmf\\Bundle\\SeoBundle\\SeoAwareInterface');
     $seoAware->expects($this->once())->method('getSeoMetadata')->will($this->returnValue($seoMetadata));
     $this->assertTrue($this->extractor->supports($seoAware));
     $channel = new Channel();
     $this->extractor->updateMetadata($seoAware, $channel);
     $this->assertSame($title, $channel->getTitle());
     $this->assertSame($description, $channel->getDescription());
     $this->assertSame($url, $channel->getLink());
 }