GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 57107a...008174 )
by Bruno
18:38
created

Bundle/YumlBundle/Yuml/YumlClientTest.php (6 issues)

Severity

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
namespace OnurbTest\Bundle\YumlBundle\Yuml;
3
4
use Onurb\Bundle\YumlBundle\DataCollector\DoctrineYumlDataCollector;
5
use Onurb\Bundle\YumlBundle\Yuml\YumlClient;
6
use Onurb\Doctrine\ORMMetadataGrapher\YUMLMetadataGrapherInterface;
7
use PHPUnit\Framework\TestCase;
8
use Symfony\Component\HttpFoundation\Response;
9
use Symfony\Component\HttpFoundation\Request;
10
use Doctrine\ORM\EntityManagerInterface;
11
12
class YumlClientTest extends TestCase
13
{
14
15
    public function setUp()
16
    {
17
        parent::setUp();
18
    }
19
20
    /**
21
     * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient
22
     */
23
    public function testIsInstanceOf()
24
    {
25
        $entityManager = $this->createMock("Doctrine\\ORM\\EntityManagerInterface");
26
        $metadataFactory = $this->getMockBuilder("Doctrine\\Common\\Persistence\\Mapping\\ClassMetadataFactory")
27
            ->setMethods(array(
28
                'getAllMetadata',
29
                'getMetadataFor',
30
                'hasMetadataFor',
31
                'setMetadataFor',
32
                'isTransient',
33
                'setEntityManager',
34
            ))
35
            ->getMock();
36
37
        $metadataFactory->expects($this->once())->method('setEntityManager');
38
39
        $metadataGrapher = $this->getMockBuilder('Onurb\\Doctrine\\ORMMetadataGrapher\\YUMLMetadataGrapherInterface')
40
            ->getMock();
41
42
        $client = new YumlClient($entityManager, $metadataFactory, $metadataGrapher);
0 ignored issues
show
$entityManager is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$metadataGrapher is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<Onurb\Doctri...tadataGrapherInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
        $this->assertInstanceOf("Onurb\\Bundle\\YumlBundle\\Yuml\\YumlClient", $client);
44
    }
45
46
    /**
47
     * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient
48
     */
49
    public function testGetMetadata()
50
    {
51
        $entityManager = $this->createMock("Doctrine\\ORM\\EntityManagerInterface");
52
53
        $metadataFactory = $this->getMockBuilder("Doctrine\\Common\\Persistence\\Mapping\\ClassMetadataFactory")
54
            ->setMethods(array(
55
                'getAllMetadata',
56
                'getMetadataFor',
57
                'hasMetadataFor',
58
                'setMetadataFor',
59
                'isTransient',
60
                'setEntityManager',
61
            ))
62
            ->getMock();
63
64
        $metadataFactory->expects($this->once())->method('setEntityManager');
65
66
        $class = $this->createmock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata');
67
        $class->expects($this->any())->method('getName')->will($this->returnValue('Simple\\Entity'));
68
        $class->expects($this->any())->method('getFieldNames')->will($this->returnValue(array('a', 'b', 'c')));
69
        $class->expects($this->any())->method('getAssociationNames')->will($this->returnValue(array()));
70
        $class->expects($this->any())->method('isIdentifier')->will(
71
            $this->returnCallback(
72
                function ($field) {
73
                    return $field === 'a';
74
                }
75
            )
76
        );
77
78
        $metadataFactory->expects($this->once())->method('getAllMetadata')->will($this->returnValue(array($class)));
79
80
        $metadataGrapher = $this->getMockBuilder('Onurb\\Doctrine\\ORMMetadataGrapher\\YUMLMetadataGrapherInterface')
81
            ->getMock();
82
83
        $metadataGrapher->expects($this->once())->method('generateFromMetadata')
84
            ->will($this->returnValue('[Simple.Entity|+a;b;c]'));
85
86
        $client = new YumlClient($entityManager, $metadataFactory, $metadataGrapher);
0 ignored issues
show
$entityManager is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$metadataGrapher is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a null|object<Onurb\Doctri...tadataGrapherInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
87
88
        $this->assertSame('[Simple.Entity|+a;b;c]', $client->makeDslText());
89
    }
90
91
    /**
92
     * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient
93
     */
94
    public function testGetGraphUrl()
95
    {
96
        $entityManager = $this->createMock("Doctrine\\ORM\\EntityManagerInterface");
97
98
        $client = new YumlClient($entityManager);
0 ignored issues
show
$entityManager is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
99
100
        $this->assertSame('https://yuml.me/15a98c92.png', $client->getGraphUrl('[Simple.Entity|+a;b;c]'));
101
    }
102
103
    /**
104
     * @covers \Onurb\Bundle\YumlBundle\Yuml\YumlClient
105
     */
106
    public function testDownloadFile()
107
    {
108
        $filename = 'test.png';
109
        $entityManager = $this->createMock("Doctrine\\ORM\\EntityManagerInterface");
110
111
        $client = new YumlClient($entityManager);
0 ignored issues
show
$entityManager is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
112
113
        $curl = $this->getMockBuilder('Onurb\\Bundle\\YumlBundle\\Curl\\CurlInterface')
114
            ->setMethods(array(
115
                '__construct',
116
                'setPosts',
117
                'setOutput',
118
                'getResponse',
119
            ))
120
            ->getMock();
121
        $curl->expects($this->once())->method('setOutput');
122
        $curl->expects($this->once())->method('getResponse')->will($this->returnValue(true));
123
        $result = $client->downloadImage('http://testUrl.test', $filename, $curl);
124
        $this->assertSame(true, $result);
125
    }
126
}
127