Skip to content

Commit

Permalink
fixed phpunit execution and updated samples
Browse files Browse the repository at this point in the history
  • Loading branch information
gijs-blanken committed Feb 11, 2025
1 parent 95cbba2 commit 89840fd
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ public PhpLaravelServerCodegen() {
setInvokerPackage("OpenAPI\\Server");

additionalProperties.put("controllerPackage", controllerPackage);
additionalProperties.put("controllerSrcPath", "." + "/" + toSrcPath(controllerPackage, srcBasePath));

apiTemplateFiles.put("api_controller.mustache", ".php");

supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("composer.mustache", "", "composer.json"));
supportingFiles.add(new SupportingFile("phpunit.mustache", "", "phpunit.xml.dist"));

typeMapping.put("file", "\\Illuminate\\Http\\UploadedFile");
languageSpecificPrimitives.add("\\Illuminate\\Http\\UploadedFile");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">{{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}}</directory>
<directory suffix=".php">{{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}}</directory>
<directory suffix=".php">{{#lambda.forwardslash}}{{controllerSrcPath}}{{/lambda.forwardslash}}</directory>
<directory suffix=".php">.</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="E_ALL" />
</php>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ Model/TestInlineFreeformAdditionalPropertiesRequest.php
Model/User.php
README.md
composer.json
phpunit.xml.dist
routes.php
21 changes: 21 additions & 0 deletions samples/server/petstore/php-laravel/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./Api</directory>
<directory suffix=".php">./Model</directory>
<directory suffix=".php">./Http/Controllers</directory>
<directory suffix=".php">.</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="E_ALL" />
</php>
</phpunit>

0 comments on commit 89840fd

Please sign in to comment.