-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for the blackList() method #14801
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phalcon\Test\Unit\Helper\Arr; | ||
|
||
use Phalcon\Helper\Arr; | ||
use stdClass; | ||
use UnitTester; | ||
|
||
class BlackListCest | ||
{ | ||
/** | ||
* Unit Tests Phalcon\Helper\Arr :: blackList() | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2020-02-01 | ||
*/ | ||
public function helperArrBlackList(UnitTester $I) | ||
{ | ||
$I->wantToTest('Helper\Arr - blackList()'); | ||
|
||
$value = [ | ||
'value-1', | ||
'key-2' => 'value-2', | ||
'key-3' => 'value-3', | ||
9 => 'value-4', | ||
12 => 'value-5', | ||
' key-6 ' => 'value-6', | ||
99 => 'value-7', | ||
'key-8' => 'value-8', | ||
]; | ||
|
||
$blackList = [ | ||
99, 48, 31, 9, 'key-45', null, -228, new stdClass(), [], 3.501, false, 'key-2', 'key-3' | ||
]; | ||
|
||
$expected = [ | ||
'value-1', | ||
|
||
|
||
|
||
12 => 'value-5', | ||
' key-6 ' => 'value-6', | ||
|
||
'key-8' => 'value-8', | ||
]; | ||
|
||
$actual = Arr::blackList($value, $blackList); | ||
|
||
$I->assertSame($expected, $actual); | ||
} | ||
} |