Skip to content

2.0 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Mar 6, 2024
Merged

2.0 #87

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/CS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CS

on:
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
name: Code Style
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: php /usr/bin/composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
- name: Verify
run: php vendor/bin/pint --test
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0",
"phpstan/phpdoc-parser": "^1.24"
"phpstan/phpdoc-parser": "^1.26"
},
"extra": {
"laravel": {
Expand All @@ -47,6 +47,7 @@
"prefer-stable": true,
"require-dev": {
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^10.0",
"laravel/pint": "^1.13"
}
}
16 changes: 15 additions & 1 deletion config/api-postman.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
| Include Doc Comments
|--------------------------------------------------------------------------
|
| Determines whether or not to set the PHP Doc comments to the description
| Determines whether to set the PHP Doc comments to the description
| in postman.
|
*/
Expand Down Expand Up @@ -156,6 +156,20 @@

'disk' => 'local',

/*
|--------------------------------------------------------------------------
| Authentication
|--------------------------------------------------------------------------
|
| Specify the authentication to be used for the endpoints.
|
*/

'authentication' => [
'method' => env('POSTMAN_EXPORT_AUTH_METHOD'),
'token' => env('POSTMAN_EXPORT_AUTH_TOKEN'),
],

/*
|--------------------------------------------------------------------------
| Protocol Profile Behavior
Expand Down
23 changes: 16 additions & 7 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage/>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
Expand All @@ -12,9 +26,4 @@
<php>
<env name="DB_CONNECTION" value="testing"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
27 changes: 27 additions & 0 deletions src/Authentication/AuthenticationMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace AndreasElia\PostmanGenerator\Authentication;

use Illuminate\Contracts\Support\Arrayable;

abstract class AuthenticationMethod implements Arrayable
{
public function __construct(protected ?string $token = null)
{
}

public function toArray(): array
{
return [
'key' => 'Authorization',
'value' => sprintf('%s %s', $this->prefix(), $this->token ?? '{{token}}'),
];
}

public function getToken(): string
{
return $this->token;
}

abstract public function prefix(): string;
}
11 changes: 11 additions & 0 deletions src/Authentication/Basic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace AndreasElia\PostmanGenerator\Authentication;

class Basic extends AuthenticationMethod
{
public function prefix(): string
{
return 'Basic';
}
}
11 changes: 11 additions & 0 deletions src/Authentication/Bearer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace AndreasElia\PostmanGenerator\Authentication;

class Bearer extends AuthenticationMethod
{
public function prefix(): string
{
return 'Bearer';
}
}
Loading