generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #28: Correct work iterable processors with non-exists fields + Fi…
…x psalm errors (#78)
- Loading branch information
Showing
19 changed files
with
284 additions
and
17 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
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
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
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
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
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
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Data\Tests\Reader\Iterable\Processor; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Data\Reader\Iterable\Processor\Equals; | ||
|
||
final class EqualsTest extends TestCase | ||
{ | ||
public function dataBase(): array | ||
{ | ||
return [ | ||
[true, ['weight', 45]], | ||
[false, ['weight', 46]], | ||
[false, ['age', 25]], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider dataBase | ||
*/ | ||
public function testBase(bool $expected, array $arguments): void | ||
{ | ||
$processor = new Equals(); | ||
|
||
$item = [ | ||
'id' => 1, | ||
'weight' => 45, | ||
]; | ||
|
||
$this->assertSame($expected, $processor->match($item, $arguments, [])); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/Reader/Iterable/Processor/GreaterThanOrEqualTest.php
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Data\Tests\Reader\Iterable\Processor; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Data\Reader\Iterable\Processor\GreaterThanOrEqual; | ||
|
||
final class GreaterThanOrEqualTest extends TestCase | ||
{ | ||
public function dataBase(): array | ||
{ | ||
return [ | ||
[true, ['weight', 44]], | ||
[true, ['weight', 45]], | ||
[false, ['weight', 46]], | ||
[false, ['age', 25]], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider dataBase | ||
*/ | ||
public function testBase(bool $expected, array $arguments): void | ||
{ | ||
$processor = new GreaterThanOrEqual(); | ||
|
||
$item = [ | ||
'id' => 1, | ||
'weight' => 45, | ||
]; | ||
|
||
$this->assertSame($expected, $processor->match($item, $arguments, [])); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Data\Tests\Reader\Iterable\Processor; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Data\Reader\Iterable\Processor\GreaterThan; | ||
|
||
final class GreaterThanTest extends TestCase | ||
{ | ||
public function dataBase(): array | ||
{ | ||
return [ | ||
[true, ['weight', 44]], | ||
[false, ['weight', 45]], | ||
[false, ['weight', 46]], | ||
[false, ['age', 25]], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider dataBase | ||
*/ | ||
public function testBase(bool $expected, array $arguments): void | ||
{ | ||
$processor = new GreaterThan(); | ||
|
||
$item = [ | ||
'id' => 1, | ||
'weight' => 45, | ||
]; | ||
|
||
$this->assertSame($expected, $processor->match($item, $arguments, [])); | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Data\Tests\Reader\Iterable\Processor; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Data\Reader\Iterable\Processor\In; | ||
|
||
final class InTest extends TestCase | ||
{ | ||
public function dataBase(): array | ||
{ | ||
return [ | ||
[true, ['weight', [44, 45, 46]]], | ||
[false, ['weight', [1, 2, 3]]], | ||
[false, ['age', [45]]], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider dataBase | ||
*/ | ||
public function testBase(bool $expected, array $arguments): void | ||
{ | ||
$processor = new In(); | ||
|
||
$item = [ | ||
'id' => 1, | ||
'weight' => 45, | ||
]; | ||
|
||
$this->assertSame($expected, $processor->match($item, $arguments, [])); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Data\Tests\Reader\Iterable\Processor; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Yiisoft\Data\Reader\Iterable\Processor\LessThanOrEqual; | ||
|
||
final class LessThanOrEqualTest extends TestCase | ||
{ | ||
public function dataBase(): array | ||
{ | ||
return [ | ||
[true, ['weight', 46]], | ||
[true, ['weight', 45]], | ||
[false, ['weight', 44]], | ||
[false, ['age', 25]], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider dataBase | ||
*/ | ||
public function testBase(bool $expected, array $arguments): void | ||
{ | ||
$processor = new LessThanOrEqual(); | ||
|
||
$item = [ | ||
'id' => 1, | ||
'weight' => 45, | ||
]; | ||
|
||
$this->assertSame($expected, $processor->match($item, $arguments, [])); | ||
} | ||
} |
Oops, something went wrong.