Code Duplication    Length = 23-23 lines in 2 locations

tests/Entity/FavouriteTest.php 1 location

@@ 7-29 (lines=23) @@
4
{
5
    protected $favourite;
6
7
    public function testCreateBox()
8
    {
9
        $this->initFavourite();
10
11
        $this->em->persist($this->favourite);
12
        $this->em->flush();
13
14
        $favourites = $this->em->getRepository('WebCMS\Entity\Favourites')->findAll();
15
16
        $this->assertEquals(1, count($favourites));
17
        $this->assertEquals('favourite', $favourites[0]->getTitle());
18
        $this->assertEquals('http://link.com', $favourites[0]->getLink());
19
        $this->assertInstanceOf('WebCMS\Entity\User', $favourites[0]->getUser());
20
21
        $this->em->remove($favourites[0]->getUser());
22
        $this->em->remove($favourites[0]);
23
24
        $this->em->flush();
25
26
        $favourites = $this->em->getRepository('WebCMS\Entity\Favourites')->findAll();
27
28
        $this->assertCount(0, $favourites);
29
    }
30
31
    private function initFavourite()
32
    {

tests/Entity/RoleTest.php 1 location

@@ 7-29 (lines=23) @@
4
{
5
    protected $role;
6
7
    public function testRole()
8
    {
9
        $this->initRole();
10
11
        $this->em->persist($this->role);
12
        $this->em->flush();
13
14
        $roles = $this->em->getRepository('WebCMS\Entity\Role')->findAll();
15
16
        $this->assertCount(1, $roles);
17
        $this->assertEquals('Role', $roles[0]->getName());
18
        $this->assertTrue($roles[0]->getAutomaticEnable());
19
        $this->assertInstanceOf('WebCMS\Entity\Permission', $roles[0]->getPermissions()[0]);
20
21
        $this->em->remove($roles[0]->getPermissions()[0]);
22
        $this->em->remove($roles[0]);
23
24
        $this->em->flush();
25
26
        $roles = $this->em->getRepository('WebCMS\Entity\Role')->findAll();
27
28
        $this->assertCount(0, $roles);
29
    }
30
31
    private function initRole()
32
    {