/** * @covers edsonmedina\php_testability\Dictionary::__construct * @covers edsonmedina\php_testability\Dictionary::isInternalFunction */ public function testIsInternalFunction() { $d = new Dictionary(); // internal function $this->assertTrue($d->isInternalFunction('substr')); // user function $this->assertFalse($d->isInternalFunction('__autoload')); // user function $this->assertFalse($d->isInternalFunction('blablabla123')); }
public function leaveNode(PhpParser\Node $node) { // check for global function calls if ($node instanceof Expr\FuncCall && !$this->inGlobalScope()) { $dictionary = new Dictionary(); $obj = new NodeWrapper($node); $functionName = $obj->getName(); // skip internal php functions if ($dictionary->isInternalFunction($functionName)) { return; } $this->stack->addIssue(new GlobalFunctionCallIssue($node)); } }