Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
125 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,7 @@ end_of_line = crlf | |
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
indent_size = 2 | ||
|
||
[*.neon] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- cake-5 | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
testsuite: | ||
uses: ADmad/.github/.github/workflows/testsuite-with-db.yml@master | ||
secrets: inherit | ||
|
||
cs-stan: | ||
uses: ADmad/.github/.github/workflows/cs-stan.yml@master | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/composer.lock | ||
/plugins | ||
/vendor | ||
.phpunit.cache | ||
.phpunit.result.cache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
parameters: | ||
level: 7 | ||
checkMissingIterableValueType: false | ||
checkGenericClassInNonGenericObjectType: false | ||
treatPhpDocTypesAsCertain: false | ||
bootstrapFiles: | ||
- tests/bootstrap.php | ||
paths: | ||
- src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
bootstrap="./tests/bootstrap.php" | ||
colors="true" | ||
stopOnFailure="false" | ||
> | ||
|
||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/bootstrap.php" colors="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache"> | ||
<testsuites> | ||
<testsuite name="Orderly Test Cases"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- Setup a listener for fixtures --> | ||
<listeners> | ||
<listener | ||
class="\Cake\TestSuite\Fixture\FixtureInjector" | ||
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php"> | ||
<arguments> | ||
<object class="\Cake\TestSuite\Fixture\FixtureManager" /> | ||
</arguments> | ||
</listener> | ||
</listeners> | ||
|
||
<filter> | ||
<whitelist> | ||
<extensions> | ||
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/> | ||
</extensions> | ||
<php> | ||
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/> | ||
</php> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src/</directory> | ||
</whitelist> | ||
</filter> | ||
</include> | ||
</source> | ||
</phpunit> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,14 @@ | |
use ArrayObject; | ||
use Cake\Event\EventInterface; | ||
use Cake\ORM\Behavior; | ||
use Cake\ORM\Query; | ||
use Cake\ORM\Query\SelectQuery; | ||
|
||
class OrderlyBehavior extends Behavior | ||
{ | ||
/** | ||
* Initialize behavior | ||
* | ||
* @param array $config Config | ||
* @param array<string, mixed> $config Config | ||
* @return void | ||
*/ | ||
public function initialize(array $config): void | ||
|
@@ -24,15 +24,15 @@ public function initialize(array $config): void | |
} | ||
|
||
/** | ||
* Add default order clause to query as necessary. | ||
* Add the default order clause to the query as necessary. | ||
* | ||
* @param \Cake\Event\EventInterface $event Event | ||
* @param \Cake\ORM\Query $query Query | ||
* @param \Cake\ORM\Query\SelectQuery $query Query | ||
* @param \ArrayObject $options Options | ||
* @param bool $primary Boolean indicating whether it's primary query. | ||
* @return void | ||
*/ | ||
public function beforeFind(EventInterface $event, Query $query, ArrayObject $options, bool $primary) | ||
public function beforeFind(EventInterface $event, SelectQuery $query, ArrayObject $options, bool $primary) | ||
Check failure on line 35 in src/Model/Behavior/OrderlyBehavior.php GitHub Actions / cs-stan / Coding Standard & Static Analysis
Check failure on line 35 in src/Model/Behavior/OrderlyBehavior.php GitHub Actions / cs-stan / Coding Standard & Static Analysis
|
||
{ | ||
if ($query->clause('order')) { | ||
return; | ||
|
@@ -44,15 +44,15 @@ public function beforeFind(EventInterface $event, Query $query, ArrayObject $opt | |
empty($config['callback']) | ||
|| call_user_func($config['callback'], $query, $options, $primary) | ||
) { | ||
$query->order($config['order']); | ||
$query->orderBy($config['order']); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Normalize configuration. | ||
* | ||
* @param array $orders Orders config | ||
* @param array<string, mixed> $orders Orders config | ||
* @return void | ||
*/ | ||
protected function _normalizeConfig(array $orders): void | ||
|
@@ -64,7 +64,10 @@ protected function _normalizeConfig(array $orders): void | |
} | ||
|
||
$default = [ | ||
'order' => $this->_table->aliasField($this->_table->getDisplayField()), | ||
'order' => array_map( | ||
$this->_table->aliasField(...), | ||
(array)$this->_table->getDisplayField() | ||
), | ||
'callback' => null, | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.