Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
laravel-11
Browse files Browse the repository at this point in the history
  • Loading branch information
MsNatali committed May 3, 2024
1 parent 2e52ae0 commit 7f92214
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check & fix styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
49 changes: 49 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: run-tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.0, 8.1, 8.2, 8.3]
laravel: [8.*, 9.*, 10.*, 11.*]
exclude:
- laravel: 10.*
php: 8.0

- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }}


steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-stable --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "ensi/test-factories",
"description": "",
"keywords": [
"laravel",
"factory"
],
"description": "",
"license": "MIT",
"type": "library",
"authors": [
Expand All @@ -16,13 +16,13 @@
"require": {
"php": "^8.0",
"fakerphp/faker": "^1.10 || ^2.0",
"illuminate/support": "^8.0 || ^9.0 || ^10.0"
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"pestphp/pest": "^1.16 || ^2.0",
"php-parallel-lint/php-var-dump-check": "^0.5.0",
"phpunit/phpunit": "^9.0 || ^10.0"
"phpunit/phpunit": "^9.0 || ^10.0 || ^11.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ protected function when(bool $condition, $value, $default = null): mixed
protected function whenNotNull($condition, $value, $default = null): mixed
{
$default = func_num_args() === 3 ? $default : new FactoryMissingValue;

return $this->when($condition !== null, $value, $default);
}

protected function executed($condition, $value, $default = null): mixed
{
$default = func_num_args() === 3 ? $default : new FactoryMissingValue;

return $this->when($condition !== null, $value, $default);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
$result = TestArrayFactory::new()->make();

expect($result)->not->toHaveKey('id');
});
});

0 comments on commit 7f92214

Please sign in to comment.