Compare commits
No commits in common. "master" and "3.0.0" have entirely different histories.
10 changed files with 8312 additions and 46 deletions
7
.github/workflows/php.yml
vendored
7
.github/workflows/php.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.2'
|
php-version: '7.3'
|
||||||
tools: phpcs
|
tools: phpcs
|
||||||
|
|
||||||
- name: Validate composer.json and composer.lock
|
- name: Validate composer.json and composer.lock
|
||||||
|
|
@ -34,10 +34,13 @@ jobs:
|
||||||
${{ runner.os }}-php-
|
${{ runner.os }}-php-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --no-progress
|
run: composer install --prefer-dist --no-progress
|
||||||
|
|
||||||
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
|
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
|
||||||
# Docs: https://getcomposer.org/doc/articles/scripts.md
|
# Docs: https://getcomposer.org/doc/articles/scripts.md
|
||||||
|
|
||||||
- name: Run test suite
|
- name: Run test suite
|
||||||
run: composer run-script test
|
run: composer run-script test
|
||||||
|
|
||||||
|
- name: OSSF Scorecard action
|
||||||
|
uses: ossf/scorecard-action@v2.0.6
|
||||||
|
|
|
||||||
72
.github/workflows/scorecards.yml
vendored
Normal file
72
.github/workflows/scorecards.yml
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||||
|
# by a third-party and are governed by separate terms of service, privacy
|
||||||
|
# policy, and support documentation.
|
||||||
|
|
||||||
|
name: Scorecards supply-chain security
|
||||||
|
on:
|
||||||
|
# For Branch-Protection check. Only the default branch is supported. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||||
|
branch_protection_rule:
|
||||||
|
# To guarantee Maintained check is occasionally updated. See
|
||||||
|
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||||
|
schedule:
|
||||||
|
- cron: '28 14 * * 1'
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
|
||||||
|
# Declare default permissions as read only.
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analysis:
|
||||||
|
name: Scorecards analysis
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# Needed to upload the results to code-scanning dashboard.
|
||||||
|
security-events: write
|
||||||
|
# Needed to publish results and get a badge (see publish_results below).
|
||||||
|
id-token: write
|
||||||
|
# Uncomment the permissions below if installing in a private repository.
|
||||||
|
# contents: read
|
||||||
|
# actions: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Checkout code"
|
||||||
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: "Run analysis"
|
||||||
|
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
|
||||||
|
with:
|
||||||
|
results_file: results.sarif
|
||||||
|
results_format: sarif
|
||||||
|
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
|
||||||
|
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||||
|
# - you are installing Scorecards on a *private* repository
|
||||||
|
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
|
||||||
|
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
|
||||||
|
|
||||||
|
# Public repositories:
|
||||||
|
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||||
|
# - Allows the repository to include the Scorecard badge.
|
||||||
|
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||||
|
# For private repositories:
|
||||||
|
# - `publish_results` will always be set to `false`, regardless
|
||||||
|
# of the value entered here.
|
||||||
|
publish_results: true
|
||||||
|
|
||||||
|
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||||
|
# format to the repository Actions tab.
|
||||||
|
- name: "Upload artifact"
|
||||||
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
|
with:
|
||||||
|
name: SARIF file
|
||||||
|
path: results.sarif
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
|
- name: "Upload to code-scanning"
|
||||||
|
uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,5 +3,4 @@ vendor
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
.phpunit.cache
|
.phpunit.cache
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
composer.lock
|
|
||||||
build
|
build
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
"post-autoload-dump": [
|
"post-autoload-dump": [
|
||||||
"@php ./vendor/bin/testbench package:discover --ansi"
|
"@php ./vendor/bin/testbench package:discover --ansi"
|
||||||
],
|
],
|
||||||
"test": "vendor/bin/phpunit"
|
"test": "vendor/bin/testbench package:test"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
|
|
|
||||||
8200
composer.lock
generated
Normal file
8200
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -32,6 +32,8 @@
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<php>
|
<php>
|
||||||
<env name="APP_ENV" value="testing"/>
|
<env name="APP_ENV" value="testing"/>
|
||||||
<env name="DB_CONNECTION" value="testing"/>
|
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
|
||||||
|
<env name="DB_CONNECTION" value="sqlite"/>
|
||||||
|
<env name="DB_DATABASE" value=":memory:"/>
|
||||||
</php>
|
</php>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||

|

|
||||||
[![Latest Version on Packagist][ico-version]][link-packagist]
|
[![Latest Version on Packagist][ico-version]][link-packagist]
|
||||||
[![Total Downloads][ico-downloads]][link-downloads]
|
[![Total Downloads][ico-downloads]][link-downloads]
|
||||||

|

|
||||||
|
|
||||||
This package goal is to provide a complete solution to lack a long time php weakness : it do not have any `enum` support.
|
This package goal is to provide a complete solution to lack a long time php weakness : it do not have any `enum` support.
|
||||||
This will change with [**php 8 enums proposition**](https://php.watch/versions/8.1/enums). In the mean time we still a support for this allowing us to generate generic and extendable applications (instead of have singletons sql tables..).
|
This will change with [**php 8 enums proposition**](https://php.watch/versions/8.1/enums). In the mean time we still a support for this allowing us to generate generic and extendable applications (instead of have singletons sql tables..).
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,37 @@ use Kwaadpepper\Enum\Tests\Enums\NotRoutableEnum;
|
||||||
use Kwaadpepper\Enum\Tests\Models\Alarm;
|
use Kwaadpepper\Enum\Tests\Models\Alarm;
|
||||||
use Kwaadpepper\Enum\Tests\Models\Journal;
|
use Kwaadpepper\Enum\Tests\Models\Journal;
|
||||||
use Kwaadpepper\Enum\Tests\Models\Report;
|
use Kwaadpepper\Enum\Tests\Models\Report;
|
||||||
|
use Orchestra\Testbench\TestCase;
|
||||||
|
|
||||||
class BaseEnumRoutableTest extends TestCase
|
class BaseEnumRoutableTest extends TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Setup custom phpunit catch for deprecated error cathing.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
set_error_handler(
|
||||||
|
static function ($errno, $errstr) {
|
||||||
|
throw new \Exception($errstr, $errno);
|
||||||
|
},
|
||||||
|
E_ALL
|
||||||
|
);
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore phpunit handler
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function tearDown(): void
|
||||||
|
{
|
||||||
|
restore_error_handler();
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines aliases
|
* Defines aliases
|
||||||
*
|
*
|
||||||
|
|
@ -50,6 +78,7 @@ class BaseEnumRoutableTest extends TestCase
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
return [
|
return [
|
||||||
|
\Illuminate\Log\LogServiceProvider::class,
|
||||||
\Kwaadpepper\Enum\EnumServiceProvider::class,
|
\Kwaadpepper\Enum\EnumServiceProvider::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ use Kwaadpepper\Enum\Tests\Enums\DuplicatedLabels;
|
||||||
use Kwaadpepper\Enum\Tests\Enums\DuplicatedValues;
|
use Kwaadpepper\Enum\Tests\Enums\DuplicatedValues;
|
||||||
use Kwaadpepper\Enum\Tests\Enums\ForceStringsFromInteger;
|
use Kwaadpepper\Enum\Tests\Enums\ForceStringsFromInteger;
|
||||||
use Kwaadpepper\Enum\Tests\Models\Report;
|
use Kwaadpepper\Enum\Tests\Models\Report;
|
||||||
|
use Orchestra\Testbench\TestCase;
|
||||||
|
|
||||||
class BaseEnumTest extends TestCase
|
class BaseEnumTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Kwaadpepper\Enum\Tests;
|
|
||||||
|
|
||||||
abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Automatically loads environment file if available.
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
*/
|
|
||||||
protected $loadEnvironmentVariables = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup custom phpunit catch for deprecated error cathing.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setUp(): void
|
|
||||||
{
|
|
||||||
set_error_handler(
|
|
||||||
static function ($errno, $errstr) {
|
|
||||||
throw new \Exception($errstr, $errno);
|
|
||||||
},
|
|
||||||
E_ALL
|
|
||||||
);
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restore phpunit handler
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function tearDown(): void
|
|
||||||
{
|
|
||||||
restore_error_handler();
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue