-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
97 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/* | ||
* Copyright 2024 Daniel Carbone ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
use DCarbone\PHPFHIR\Enum\TestTypeEnum; | ||
|
||
/** @var \DCarbone\PHPFHIR\Config $config */ | ||
|
||
ob_start(); | ||
|
||
echo '<?php'; ?> | ||
|
||
namespace <?php echo $config->getFullyQualifiedTestsName(TestTypeEnum::BASE, false); ?>; | ||
|
||
<?php echo $config->getBasePHPFHIRCopyrightComment(false); ?> | ||
|
||
|
||
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_CLASSNAME_CONSTANTS); ?>; | ||
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_CLASSNAME_FACTORY_CONFIG); ?>; | ||
use <?php echo $config->getFullyQualifiedName(false, PHPFHIR_ENUM_FACTORY_CONFIG_KEY); ?>; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class <?php echo PHPFHIR_TEST_CLASSNAME_FACTORY_CONFIG; ?> extends TestCase | ||
{ | ||
public function testFactoryConfigEmpty(): void | ||
{ | ||
$config = new <?php echo PHPFHIR_CLASSNAME_FACTORY_CONFIG; ?>(); | ||
$this->assertCount(0, $config->getVersionsIterator()); | ||
} | ||
|
||
public function testFactoryConfigVersionArrayMissingName(): void | ||
{ | ||
$this->expectException(\InvalidArgumentException::class); | ||
$config = new <?php echo PHPFHIR_CLASSNAME_FACTORY_CONFIG; ?>([ | ||
'versions' => [ | ||
'class' => 'some class', | ||
] | ||
]); | ||
} | ||
|
||
public function testFactoryConfigVersionArrayMissingClass(): void | ||
{ | ||
$this->expectException(\InvalidArgumentException::class); | ||
$config = new <?php echo PHPFHIR_CLASSNAME_FACTORY_CONFIG; ?>([ | ||
'versions' => [ | ||
'name' => 'FHIRTEST', | ||
] | ||
]); | ||
} | ||
|
||
public function testFactoryConfigVersionArrayInvalidClass(): void | ||
{ | ||
$this->expectException(\InvalidArgumentException::class); | ||
$config = new <?php echo PHPFHIR_CLASSNAME_FACTORY_CONFIG; ?>([ | ||
'versions' => [ | ||
'name' => 'FHIRTEST', | ||
'class' => \stdClass::class, | ||
] | ||
]); | ||
} | ||
} | ||
<?php | ||
return ob_get_clean(); |