Completed
Push — master ( 6d6774...64f3ed )
by Jeroen
11:23 queued 05:13
created

Tests/unit/Entity/AudioPagePartTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\MediaPagePartBundle\Tests\Entity;
4
5
use Kunstmaan\MediaBundle\Entity\Media;
6
use Kunstmaan\MediaPagePartBundle\Entity\AudioPagePart;
7
use Kunstmaan\MediaPagePartBundle\Entity\VideoPagePart;
8
use Kunstmaan\MediaPagePartBundle\Form\AudioPagePartAdminType;
9
use PHPUnit\Framework\TestCase;
10
11 View Code Duplication
class AudioPagePartTest extends TestCase
12
{
13
    /**
14
     * @var VideoPagePart
15
     */
16
    protected $object;
17
18
    /**
19
     * Sets up the fixture, for example, opens a network connection.
20
     * This method is called before a test is executed.
21
     */
22
    protected function setUp()
23
    {
24
        $this->object = new AudioPagePart();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Kunstmaan\MediaPage...\Entity\AudioPagePart() of type object<Kunstmaan\MediaPa...e\Entity\AudioPagePart> is incompatible with the declared type object<Kunstmaan\MediaPa...e\Entity\VideoPagePart> of property $object.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25
    }
26
27
    public function testSetGetMedia()
28
    {
29
        $media = new Media();
30
        $media->setUrl('https://nasa.gov/spongebob.jpg');
31
        $media->setId(5);
32
        $this->object->setMedia($media);
33
        $this->assertEquals(5, $this->object->getMedia()->getId());
34
        $this->assertEquals('https://nasa.gov/spongebob.jpg', $this->object->__toString());
35
        $pp = new AudioPagePart();
36
        $this->assertEquals('', $pp->__toString());
37
    }
38
39
    public function testGetDefaultView()
40
    {
41
        $defaultView = $this->object->getDefaultView();
42
        $this->assertEquals('@KunstmaanMediaPagePart/AudioPagePart/view.html.twig', $defaultView);
43
    }
44
45
    public function testGetDefaultAdminType()
46
    {
47
        $defaultAdminType = $this->object->getDefaultAdminType();
48
        $this->assertEquals(AudioPagePartAdminType::class, $defaultAdminType);
49
    }
50
}
51