testInvalidParamsToConstructorSecret()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace limenet\S3BucketStreamZipTest;
4
5
use limenet\S3BucketStreamZip\S3BucketStreamZip;
6
use PHPUnit_Framework_TestCase;
7
8
class S3BucketStreamZipTest extends PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @expectedException \limenet\S3BucketStreamZip\Exception\InvalidParameterException
12
     */
13
    public function testInvalidParamsToConstructorKey()
14
    {
15
        $client = new S3BucketStreamZip([], []);
0 ignored issues
show
Documentation introduced by
array() is of type array, but the function expects a integer.

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...
Unused Code introduced by
$client is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
16
    }
17
18
    /**
19
     * @expectedException \limenet\S3BucketStreamZip\Exception\InvalidParameterException
20
     */
21
    public function testInvalidParamsToConstructorSecret()
22
    {
23
        $client = new S3BucketStreamZip(['key' => 'foo'], []);
0 ignored issues
show
Documentation introduced by
array() is of type array, but the function expects a integer.

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...
Unused Code introduced by
$client is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
24
    }
25
26
    /**
27
     * @expectedException \limenet\S3BucketStreamZip\Exception\InvalidParameterException
28
     */
29
    public function testInvalidParamsToConstructorBucket()
30
    {
31
        $client = new S3BucketStreamZip(['key' => 'foo', 'secret' => 'bar'], []);
0 ignored issues
show
Documentation introduced by
array() is of type array, but the function expects a integer.

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...
Unused Code introduced by
$client is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
32
    }
33
34
    public function testValidParamsToConstructor()
35
    {
36
        $client = new S3BucketStreamZip([
0 ignored issues
show
Unused Code introduced by
$client is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
37
            'key'     => 'foo',
38
            'secret'  => 'bar',
39
            'region'  => '',
40
            'version' => 'latest',
41
        ], ['Bucket' => 'foobar']);
0 ignored issues
show
Documentation introduced by
array('Bucket' => 'foobar') is of type array<string,string,{"Bucket":"string"}>, but the function expects a integer.

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...
42
    }
43
}
44