mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 09:32:24 -04:00
Add Safe PHP functions
This commit is contained in:
parent
04a956886a
commit
58cc098058
260 changed files with 49458 additions and 45 deletions
44
vendor/thecodingmachine/safe/generator/tests/MethodTest.php
vendored
Normal file
44
vendor/thecodingmachine/safe/generator/tests/MethodTest.php
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Safe\PhpStanFunctions\PhpStanFunctionMapReader;
|
||||
|
||||
class MethodTest extends TestCase
|
||||
{
|
||||
public function testGetFunctionName() {
|
||||
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/pcre/functions/preg-match.xml');
|
||||
$xmlObject = $docPage->getMethodSynopsis();
|
||||
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader());
|
||||
$name = $method->getFunctionName();
|
||||
$this->assertEquals('preg_match', $name);
|
||||
}
|
||||
|
||||
public function testGetFunctionType() {
|
||||
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/pcre/functions/preg-match.xml');
|
||||
$xmlObject = $docPage->getMethodSynopsis();
|
||||
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader());
|
||||
$type = $method->getReturnType();
|
||||
$this->assertEquals('int', $type);
|
||||
}
|
||||
|
||||
public function testGetFunctionParam() {
|
||||
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/pcre/functions/preg-match.xml');
|
||||
$xmlObject = $docPage->getMethodSynopsis();
|
||||
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader());
|
||||
$params = $method->getParams();
|
||||
$this->assertEquals('string', $params[0]->getType());
|
||||
$this->assertEquals('pattern', $params[0]->getParameter());
|
||||
}
|
||||
|
||||
public function testGetInitializer() {
|
||||
$docPage = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/apc/functions/apc-cache-info.xml');
|
||||
$xmlObject = $docPage->getMethodSynopsis();
|
||||
$method = new Method($xmlObject[0], $docPage->loadAndResolveFile(), $docPage->getModule(), new PhpStanFunctionMapReader());
|
||||
|
||||
$params = $method->getParams();
|
||||
$this->assertEquals('', $params[0]->getDefaultValue());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue