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

Base_PHPUnit6::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_PHPUnit6 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
	/**
6
	 * @param string $exception
7
	 * @param string $message
8
	 * @return void
9
	 */
10
	public function expectException($exception, $message = '')
11
	{
12
		parent::expectException($exception);
13
		if ($message !== '') {
14
			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...
15
		}
16
	}
17
}
18