OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
vendor
/
zircote
/
swagger-php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:34:03 AM
rwxr-xr-x
📁
Analysers
-
08/07/2024 04:34:31 AM
rwxr-xr-x
📄
AnalysisTest.php
4.09 KB
08/07/2024 04:34:02 AM
rw-r--r--
📁
Annotations
-
08/07/2024 04:34:31 AM
rwxr-xr-x
📄
CommandlineTest.php
2.47 KB
08/07/2024 04:34:02 AM
rw-r--r--
📄
ConstantsTest.php
2.24 KB
08/07/2024 04:34:02 AM
rw-r--r--
📄
ContextTest.php
2.79 KB
08/07/2024 04:34:02 AM
rw-r--r--
📄
ExamplesTest.php
8.22 KB
08/07/2024 04:34:02 AM
rw-r--r--
📁
Fixtures
-
08/07/2024 04:34:54 AM
rwxr-xr-x
📄
GeneratorTest.php
4.71 KB
08/07/2024 04:34:02 AM
rw-r--r--
📄
OpenApiTestCase.php
9.78 KB
08/07/2024 04:34:02 AM
rw-r--r--
📄
PipelineTest.php
2.52 KB
08/07/2024 04:34:03 AM
rw-r--r--
📁
Processors
-
08/07/2024 04:34:33 AM
rwxr-xr-x
📄
RefTest.php
1.08 KB
08/07/2024 04:34:03 AM
rw-r--r--
📁
Samples
-
08/07/2024 04:34:33 AM
rwxr-xr-x
📄
ScratchTest.php
1.94 KB
08/07/2024 04:34:03 AM
rw-r--r--
📄
SerializerTest.php
6.39 KB
08/07/2024 04:34:03 AM
rw-r--r--
📄
UtilTest.php
2.84 KB
08/07/2024 04:34:03 AM
rw-r--r--
📄
cl_bootstrap.php
342 bytes
08/07/2024 04:34:02 AM
rw-r--r--
Editing: ConstantsTest.php
Close
<?php declare(strict_types=1); /** * @license Apache 2.0 */ namespace OpenApi\Tests; use OpenApi\Analysers\TokenAnalyser; use OpenApi\Generator; class ConstantsTest extends OpenApiTestCase { public const URL = 'http://example.com'; private static $counter = 0; public function testConstant(): void { self::$counter++; $const = 'OPENAPI_TEST_' . self::$counter; $this->assertFalse(defined($const)); $this->assertOpenApiLogEntryContains("[Semantical Error] Couldn't find constant " . $const); $this->annotationsFromDocBlockParser('@OA\Contact(email=' . $const . ')'); define($const, 'me@domain.org'); $annotations = $this->annotationsFromDocBlockParser('@OA\Contact(email=' . $const . ')'); $this->assertSame('me@domain.org', $annotations[0]->email); } public function testFQCNConstant(): void { $annotations = $this->annotationsFromDocBlockParser('@OA\Contact(url=OpenApi\Tests\ConstantsTest::URL)'); $this->assertSame('http://example.com', $annotations[0]->url); $annotations = $this->annotationsFromDocBlockParser('@OA\Contact(url=\OpenApi\Tests\ConstantsTest::URL)'); $this->assertSame('http://example.com', $annotations[0]->url); } public function testInvalidClass(): void { $this->assertOpenApiLogEntryContains("[Semantical Error] Couldn't find constant ConstantsTest::URL"); $this->annotationsFromDocBlockParser('@OA\Contact(url=ConstantsTest::URL)'); } public function testAutoloadConstant(): void { if (class_exists('AnotherNamespace\Annotations\Constants', false)) { $this->markTestSkipped(); } $annotations = $this->annotationsFromDocBlockParser('@OA\Contact(name=AnotherNamespace\Annotations\Constants::INVALID_TIMEZONE_LOCATION)'); $this->assertSame('invalidTimezoneLocation', $annotations[0]->name); } public function testDynamicImports(): void { $analyser = new TokenAnalyser(); $analyser->setGenerator((new Generator())->setNamespaces(null)); $analyser->fromFile($this->fixture('Customer.php'), $this->getContext()); $analyser->fromFile($this->fixture('ThirdPartyAnnotations.php'), $this->getContext()); } }