Completed
Push — master ( 365b3d...e3be67 )
by Adelar
02:41
created

OfxTest::constructorShouldConfigureAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Adelarcubs\OFXParser\Unit;
3
4
use PHPUnit_Framework_TestCase;
5
use SimpleXMLElement;
6
use Adelarcubs\OFXParser\Ofx;
7
8
/**
9
 *
10
 * @author Adelar Tiemann Junior <[email protected]>
11
 */
12
class OfxTest extends PHPUnit_Framework_TestCase
13
{
14
15
    private $ofx;
16
17
    protected function setUp()
18
    {
19
        $this->ofx = Ofx::loadFromFile(__DIR__ . '/../fixtures/data.ofx');
0 ignored issues
show
Documentation introduced by
__DIR__ . '/../fixtures/data.ofx' is of type string, but the function expects a object<Adelarcubs\OFXParser\unknown>.

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...
20
    }
21
22
    /**
23
     * @test
24
     */
25
    public function constructorShouldConfigureAttributes()
26
    {
27
        $this->assertInstanceOf(Ofx::class, $this->ofx);
28
    }
29
30
    /**
31
     * @test
32
     * @expectedException InvalidArgumentException
33
     */
34
    public function invalidFile()
35
    {
36
        Ofx::loadFromFile('Anywhere');
0 ignored issues
show
Documentation introduced by
'Anywhere' is of type string, but the function expects a object<Adelarcubs\OFXParser\unknown>.

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...
37
    }
38
}
39