Esempio n. 1
0
 public function load(ObjectManager $manager)
 {
     $articleTestOne = new Article();
     $articleTestOne->setTitle('Article de test 1')->setLeading('Summary')->setBody('This is the content')->setCreatedBy('User test 1');
     $articleTestSecond = new Article();
     $articleTestSecond->setTitle('Article de test 2')->setLeading('Summary 2')->setBody('This is the content 2')->setCreatedBy('User test 2');
     $manager->persist($articleTestOne);
     $manager->persist($articleTestSecond);
     $manager->flush();
 }
Esempio n. 2
0
 /**
  * Tests generic getters and setters
  *
  * @return void
  */
 public function testGettersSetters()
 {
     $methodToTest = ['title' => 'This is a title', 'leading' => 'This is a leading', 'body' => 'This is a content of the article', 'createdBy' => 'Hao', 'createdAt' => new \DateTime()];
     $articleTest = new Article();
     $articleTest->setTitle($methodToTest['title'])->setLeading($methodToTest['leading'])->setBody($methodToTest['body'])->setCreatedBy($methodToTest['createdBy']);
     $this->assertEquals($methodToTest['title'], $articleTest->getTitle());
     $this->assertEquals($methodToTest['leading'], $articleTest->getLeading());
     $this->assertEquals($methodToTest['body'], $articleTest->getBody());
     $this->assertNull($articleTest->getSlug());
     $this->assertEquals($methodToTest['createdBy'], $articleTest->getCreatedBy());
     $this->assertEquals($methodToTest['createdAt'], $articleTest->getCreatedAt());
 }