1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace functional\phpDocumentor\core; |
6
|
|
|
|
7
|
|
|
use phpDocumentor\Descriptor\ClassDescriptor; |
8
|
|
|
use phpDocumentor\Descriptor\ConstantDescriptor; |
9
|
|
|
use phpDocumentor\Descriptor\MethodDescriptor; |
10
|
|
|
use phpDocumentor\Descriptor\PropertyDescriptor; |
11
|
|
|
use phpDocumentor\FunctionalTestCase; |
12
|
|
|
|
13
|
|
|
final class Issue2421FunctionalTest extends FunctionalTestCase |
14
|
|
|
{ |
15
|
|
|
public function testConstantEscapedValueIsProcessedCorrectly() : void |
16
|
|
|
{ |
17
|
|
|
$this->runPHPDocWithFile(__DIR__ . '/../../assets/core/issues/issue-2421/issue-2421.php'); |
18
|
|
|
$project = $this->loadAst(); |
19
|
|
|
|
20
|
|
|
/** @var ClassDescriptor $classDescriptor */ |
21
|
|
|
$classDescriptor = $project->getIndexes()->get('classes')->get('\Issue2421'); |
22
|
|
|
|
23
|
|
|
/** @var ConstantDescriptor $constant */ |
24
|
|
|
$constant = $classDescriptor->getConstants()->get('PHP_LABEL_REGEX'); |
25
|
|
|
|
26
|
|
|
$this->assertSame("'`^[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*$`'", $constant->getValue()); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function testPropertyEscapedDefaultValueIsProcessedCorrectly() : void |
30
|
|
|
{ |
31
|
|
|
$this->runPHPDocWithFile(__DIR__ . '/../../assets/core/issues/issue-2421/issue-2421.php'); |
32
|
|
|
$project = $this->loadAst(); |
33
|
|
|
|
34
|
|
|
/** @var ClassDescriptor $classDescriptor */ |
35
|
|
|
$classDescriptor = $project->getIndexes()->get('classes')->get('\Issue2421'); |
36
|
|
|
|
37
|
|
|
/** @var PropertyDescriptor $propertyDescriptor */ |
38
|
|
|
$propertyDescriptor = $classDescriptor->getProperties()->get('PHP_LABEL_REGEX'); |
39
|
|
|
|
40
|
|
|
$this->assertSame("'`^[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*$`'", $propertyDescriptor->getDefault()); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
public function testMethodArgumentEscapedDefaultValueIsProcessedCorrectly() : void |
45
|
|
|
{ |
46
|
|
|
$this->runPHPDocWithFile(__DIR__ . '/../../assets/core/issues/issue-2421/issue-2421.php'); |
47
|
|
|
$project = $this->loadAst(); |
48
|
|
|
|
49
|
|
|
/** @var ClassDescriptor $classDescriptor */ |
50
|
|
|
$classDescriptor = $project->getIndexes()->get('classes')->get('\Issue2421'); |
51
|
|
|
|
52
|
|
|
/** @var MethodDescriptor $methodDescriptor */ |
53
|
|
|
$methodDescriptor = $classDescriptor->getMethods()->get('issue'); |
54
|
|
|
|
55
|
|
|
$this->assertSame( |
56
|
|
|
"'`^[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*$`'", |
57
|
|
|
$methodDescriptor->getArguments()->get('regex')->getDefault() |
58
|
|
|
); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|