Completed
Push — master ( 5b4fcf...5a8d3e )
by Martijn
11s
created

Base_PHPUnit7::expectException()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
class Base_PHPUnit7 extends PHPUnit\Framework\TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
	public function expectException(string $exception, string $message = ''): void
6
	{
7
		parent::expectException($exception);
8
		if ($message !== '') {
9
			parent::expectExceptionMessage($message);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (expectExceptionMessage() instead of expectException()). Are you sure this is correct? If so, you might want to change this to $this->expectExceptionMessage().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
10
		}
11
	}
12
}
13