Skip to content

Commit 0ee1226

Browse files
committed
wip
1 parent 91b85f9 commit 0ee1226

File tree

6 files changed

+78
-41
lines changed

6 files changed

+78
-41
lines changed

.github/workflows/run-tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
php: [7.4, 7.3, 7.2]
14-
laravel: [8.*, 7.*, 6.*, 5.8.*]
13+
php: [7.4, 7.3]
14+
laravel: [8.*, 7.*, 6.*]
1515
dependency-version: [prefer-lowest, prefer-stable]
1616
os: [ubuntu-latest]
1717
include:
@@ -21,8 +21,6 @@ jobs:
2121
testbench: 5.*
2222
- laravel: 6.*
2323
testbench: 4.*
24-
- laravel: 5.8.*
25-
testbench: 3.8.*
2624

2725
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
2826

.php_cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->notPath('bootstrap/*')
5+
->notPath('storage/*')
6+
->notPath('vendor')
7+
->in([
8+
__DIR__ . '/src',
9+
__DIR__ . '/tests',
10+
])
11+
->name('*.php')
12+
->notName('*.blade.php')
13+
->ignoreDotFiles(true)
14+
->ignoreVCS(true);
15+
16+
return PhpCsFixer\Config::create()
17+
->setRules([
18+
'@PSR2' => true,
19+
'array_syntax' => ['syntax' => 'short'],
20+
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
21+
'no_unused_imports' => true,
22+
'not_operator_with_successor_space' => true,
23+
'trailing_comma_in_multiline_array' => true,
24+
'phpdoc_scalar' => true,
25+
'unary_operator_spaces' => true,
26+
'binary_operator_spaces' => true,
27+
'blank_line_before_statement' => [
28+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
29+
],
30+
'phpdoc_single_line_var_spacing' => true,
31+
'phpdoc_var_without_name' => true,
32+
'class_attributes_separation' => [
33+
'elements' => [
34+
'method', 'property',
35+
],
36+
],
37+
'method_argument_space' => [
38+
'on_multiline' => 'ensure_fully_multiline',
39+
'keep_multiple_spaces_after_comma' => true,
40+
]
41+
])
42+
->setFinder($finder);

composer.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.1",
24-
"illuminate/database": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0",
25-
"illuminate/http": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0",
26-
"illuminate/support": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0"
23+
"php": "^7.3",
24+
"illuminate/database": "^6.0|^7.0|^8.0",
25+
"illuminate/http": "^6.0|^7.0|^8.0",
26+
"illuminate/support": "^6.0|^7.0|^8.0"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "^7.0|^8.0|^9.0",
30-
"orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0|^6.0",
31-
32-
"ext-json": "*"
29+
"ext-json": "*",
30+
"friendsofphp/php-cs-fixer": "^2.16",
31+
"laravel/legacy-factories": "^1.0",
32+
"orchestra/testbench": "^4.0|^5.0|^6.0",
33+
"phpunit/phpunit": "^9.0"
3334
},
3435
"autoload": {
3536
"psr-4": {
@@ -43,7 +44,8 @@
4344
},
4445
"scripts": {
4546
"test": "vendor/bin/phpunit",
46-
"test-coverage": "phpunit --coverage-html coverage"
47+
"test-coverage": "phpunit --coverage-html coverage",
48+
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
4749
},
4850
"config": {
4951
"sort-packages": true

phpunit.xml.dist

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="true"
11-
stopOnFailure="false">
12-
<testsuites>
13-
<testsuite name="Spatie Test Suite">
14-
<directory>tests</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
22-
<php>
23-
<env name="DB_CONNECTION" value="mysql"/>
24-
<env name="DB_USERNAME" value="root"/>
25-
<env name="DB_DATABASE" value="laravel_query_builder"/>
26-
<env name="DB_HOST" value="127.0.0.1" />
27-
<env name="DB_PORT" value="3306" />
28-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Spatie Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<php>
14+
<env name="DB_CONNECTION" value="mysql"/>
15+
<env name="DB_USERNAME" value="root"/>
16+
<env name="DB_DATABASE" value="laravel_query_builder"/>
17+
<env name="DB_HOST" value="127.0.0.1"/>
18+
<env name="DB_PORT" value="3306"/>
19+
</php>
2920
</phpunit>

src/QueryBuilderRequest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
class QueryBuilderRequest extends Request
1010
{
1111
private static $includesArrayValueDelimiter = ',';
12+
1213
private static $appendsArrayValueDelimiter = ',';
14+
1315
private static $fieldsArrayValueDelimiter = ',';
16+
1417
private static $sortsArrayValueDelimiter = ',';
18+
1519
private static $filterArrayValueDelimiter = ',';
1620

1721
public static function setArrayValueDelimiter(string $delimiter): void

tests/FilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function it_can_filter_results_by_type_hinted_scope()
216216
/** @test */
217217
public function it_can_filter_results_by_regular_and_type_hinted_scope()
218218
{
219-
TestModel::create(['id'=> 1000, 'name' => 'John Testing Doe']);
219+
TestModel::create(['id' => 1000, 'name' => 'John Testing Doe']);
220220

221221
$modelsResult = $this
222222
->createQueryFromFilterRequest(['user_info' => ['id' => '1000', 'name' => 'John Testing Doe']])

0 commit comments

Comments
 (0)