Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Sep 8, 2020
1 parent 91b85f9 commit 0ee1226
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 41 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php: [7.4, 7.3, 7.2]
laravel: [8.*, 7.*, 6.*, 5.8.*]
php: [7.4, 7.3]
laravel: [8.*, 7.*, 6.*]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-latest]
include:
Expand All @@ -21,8 +21,6 @@ jobs:
testbench: 5.*
- laravel: 6.*
testbench: 4.*
- laravel: 5.8.*
testbench: 3.8.*

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

Expand Down
42 changes: 42 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/*')
->notPath('storage/*')
->notPath('vendor')
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline_array' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method', 'property',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
]
])
->setFinder($finder);
20 changes: 11 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
}
],
"require": {
"php": "^7.1",
"illuminate/database": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0",
"illuminate/http": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0",
"illuminate/support": "~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0"
"php": "^7.3",
"illuminate/database": "^6.0|^7.0|^8.0",
"illuminate/http": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0|^8.0|^9.0",
"orchestra/testbench": "~3.6.0|~3.7.0|~3.8.0|^4.0|^5.0|^6.0",

"ext-json": "*"
"ext-json": "*",
"friendsofphp/php-cs-fixer": "^2.16",
"laravel/legacy-factories": "^1.0",
"orchestra/testbench": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand All @@ -43,7 +44,8 @@
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "phpunit --coverage-html coverage"
"test-coverage": "phpunit --coverage-html coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
},
"config": {
"sort-packages": true
Expand Down
45 changes: 18 additions & 27 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false">
<testsuites>
<testsuite name="Spatie Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<php>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_DATABASE" value="laravel_query_builder"/>
<env name="DB_HOST" value="127.0.0.1" />
<env name="DB_PORT" value="3306" />
</php>
<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">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Spatie Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_DATABASE" value="laravel_query_builder"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3306"/>
</php>
</phpunit>
4 changes: 4 additions & 0 deletions src/QueryBuilderRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
class QueryBuilderRequest extends Request
{
private static $includesArrayValueDelimiter = ',';

private static $appendsArrayValueDelimiter = ',';

private static $fieldsArrayValueDelimiter = ',';

private static $sortsArrayValueDelimiter = ',';

private static $filterArrayValueDelimiter = ',';

public static function setArrayValueDelimiter(string $delimiter): void
Expand Down
2 changes: 1 addition & 1 deletion tests/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function it_can_filter_results_by_type_hinted_scope()
/** @test */
public function it_can_filter_results_by_regular_and_type_hinted_scope()
{
TestModel::create(['id'=> 1000, 'name' => 'John Testing Doe']);
TestModel::create(['id' => 1000, 'name' => 'John Testing Doe']);

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

0 comments on commit 0ee1226

Please sign in to comment.