Compare commits
9 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
583984b157 | ||
|
|
8bd0bb17e4 | ||
|
|
385552f454 | ||
|
|
b671dd3e1c | ||
|
|
beb64c6470 | ||
|
|
0277f4d0bc | ||
|
|
3687d37c2f | ||
|
|
ff3f6336db | ||
|
|
7b2f3530e9 |
10 changed files with 46 additions and 8312 deletions
7
.github/workflows/php.yml
vendored
7
.github/workflows/php.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.3'
|
||||
php-version: '8.2'
|
||||
tools: phpcs
|
||||
|
||||
- name: Validate composer.json and composer.lock
|
||||
|
|
@ -34,13 +34,10 @@ jobs:
|
|||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
run: composer install --no-progress
|
||||
|
||||
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
|
||||
# Docs: https://getcomposer.org/doc/articles/scripts.md
|
||||
|
||||
- name: Run test suite
|
||||
run: composer run-script test
|
||||
|
||||
- name: OSSF Scorecard action
|
||||
uses: ossf/scorecard-action@v2.0.6
|
||||
|
|
|
|||
72
.github/workflows/scorecards.yml
vendored
72
.github/workflows/scorecards.yml
vendored
|
|
@ -1,72 +0,0 @@
|
|||
# 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,4 +3,5 @@ vendor
|
|||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
.vscode/launch.json
|
||||
composer.lock
|
||||
build
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
"post-autoload-dump": [
|
||||
"@php ./vendor/bin/testbench package:discover --ansi"
|
||||
],
|
||||
"test": "vendor/bin/testbench package:test"
|
||||
"test": "vendor/bin/phpunit"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
|
|
|
|||
8200
composer.lock
generated
8200
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -32,8 +32,6 @@
|
|||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="DB_CONNECTION" value="testing"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||

|
||||
[![Latest Version on Packagist][ico-version]][link-packagist]
|
||||
[![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 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,37 +15,9 @@ use Kwaadpepper\Enum\Tests\Enums\NotRoutableEnum;
|
|||
use Kwaadpepper\Enum\Tests\Models\Alarm;
|
||||
use Kwaadpepper\Enum\Tests\Models\Journal;
|
||||
use Kwaadpepper\Enum\Tests\Models\Report;
|
||||
use Orchestra\Testbench\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
|
||||
*
|
||||
|
|
@ -78,7 +50,6 @@ class BaseEnumRoutableTest extends TestCase
|
|||
{
|
||||
// phpcs:enable
|
||||
return [
|
||||
\Illuminate\Log\LogServiceProvider::class,
|
||||
\Kwaadpepper\Enum\EnumServiceProvider::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use Kwaadpepper\Enum\Tests\Enums\DuplicatedLabels;
|
|||
use Kwaadpepper\Enum\Tests\Enums\DuplicatedValues;
|
||||
use Kwaadpepper\Enum\Tests\Enums\ForceStringsFromInteger;
|
||||
use Kwaadpepper\Enum\Tests\Models\Report;
|
||||
use Orchestra\Testbench\TestCase;
|
||||
|
||||
class BaseEnumTest extends TestCase
|
||||
{
|
||||
|
|
|
|||
40
tests/TestCase.php
Normal file
40
tests/TestCase.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?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