-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #250 from rodrigoprimo/test-coverage-uselessoverri…
…ding-method Generic/UselessOverridingMethod: improve code coverage
- Loading branch information
Showing
7 changed files
with
130 additions
and
30 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.1.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
class FooBar { | ||
public function __construct($a, $b) { | ||
parent::__construct($a, $b); | ||
} | ||
} | ||
|
||
class BarFoo { | ||
public function __construct($a, $b) { | ||
parent::__construct($a, 'XML', $b); | ||
} | ||
} | ||
|
||
class Foo { | ||
public function export($a, $b = null) { | ||
return parent::export($a, $b); | ||
} | ||
} | ||
|
||
class Bar { | ||
public function export($a, $b = null) { | ||
return parent::export($a); | ||
} | ||
|
||
public function ignoreNoParent($a, $b) { | ||
return $a + $b; | ||
} | ||
|
||
public function differentParentMethod($a, $b) { | ||
return parent::anotherMethod($a, $b); | ||
} | ||
|
||
public function methodCallWithExpression($a, $b) { | ||
return parent::methodCallWithExpression(($a + $b), ($b)); | ||
} | ||
|
||
public function uselessMethodCallWithExpression($a, $b) { | ||
return parent::uselessMethodCallWithExpression(($a), ($b)); | ||
} | ||
|
||
public function contentAfterCallingParent() { | ||
parent::contentAfterCallingParent(); | ||
|
||
return 1; | ||
} | ||
|
||
public function ignoreNoParentVoidMethod($a, $b) { | ||
$c = $a + $b; | ||
} | ||
|
||
public function modifiesParentReturnValue($a, $b) { | ||
return parent::modifiesParentReturnValue($a, $b) + $b; | ||
} | ||
|
||
public function uselessMethodCallTrailingComma($a) { | ||
return parent::uselessMethodCallTrailingComma($a,); | ||
} | ||
|
||
public function differentParameterOrder($a, $b) { | ||
return parent::differentParameterOrder($b, $a); | ||
} | ||
|
||
public function sameNumberDifferentParameters($a, $b) { | ||
return parent::sameNumberDifferentParameters($this->prop[$a], $this->{$b}); | ||
} | ||
} | ||
|
||
abstract class AbstractFoo { | ||
abstract public function sniffShouldBailEarly(); | ||
} | ||
|
||
interface InterfaceFoo { | ||
public function sniffShouldBailEarly(); | ||
} | ||
|
||
trait TraitFoo { | ||
abstract public function sniffShouldBailEarly(); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.2.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
// Intentional parse error (missing opening bracket). Testing that the sniff is *not* triggered | ||
// in this case. | ||
|
||
class FooBar { | ||
public function __construct() |
10 changes: 10 additions & 0 deletions
10
src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.3.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
// Intentional parse error (missing double colon after parent keyword). Testing that the sniff is *not* triggered | ||
// in this case. | ||
|
||
class FooBar { | ||
public function __construct() { | ||
parent | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.4.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
// Intentional parse error (missing parent method opening parenthesis). | ||
// Testing that the sniff is *not* triggered in this case. | ||
|
||
class FooBar { | ||
public function __construct() { | ||
parent::__construct | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.5.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
// Intentional parse error (missing semicolon). | ||
// Testing that the sniff is *not* triggered in this case. | ||
|
||
class FooBar { | ||
public function __construct() { | ||
parent::__construct() | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.inc
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters