add positive tests for operator in code checker
This commit is contained in:
parent
aae098c24a
commit
493844eda4
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GoodClass - uses identical operator
|
||||||
|
*/
|
||||||
|
class GoodClass {
|
||||||
|
public function foo() {
|
||||||
|
if (true === false) {
|
||||||
|
}
|
||||||
|
if (true !== false) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,4 +39,21 @@ class CodeChecker extends TestCase {
|
||||||
['!=', 1005, 'test-not-equal.php'],
|
['!=', 1005, 'test-not-equal.php'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider validFilesData
|
||||||
|
* @param $fileToVerify
|
||||||
|
*/
|
||||||
|
public function testPassValidUsage($fileToVerify) {
|
||||||
|
$checker = new OC\App\CodeChecker();
|
||||||
|
$errors = $checker->analyseFile(OC::$SERVERROOT . "/tests/data/app/code-checker/$fileToVerify");
|
||||||
|
|
||||||
|
$this->assertEquals(0, count($errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validFilesData() {
|
||||||
|
return [
|
||||||
|
['test-identical-operator.php'],
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue