1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- // Copyright 2022 Hackware SpA <human@hackware.cl>
- // "Hackware Web Services Core" is released under the MIT License terms.
- namespace Hawese\Tests;
- use Hawese\Core\Support\Arr;
- class SupportTest extends TestCase
- {
- public function testArrKeyExistsCaseInsensitive()
- {
- $arr = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
- $this->assertFalse(Arr::keyExists($arr, 'd'));
- $this->assertTrue(Arr::keyExists($arr, 'B'));
- $this->assertTrue(Arr::keyExists($arr, 'b'));
- }
- public function testArrKeyExistsCaseSensitive()
- {
- $arr = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
- $this->assertFalse(Arr::keyExists($arr, 'd', false));
- $this->assertFalse(Arr::keyExists($arr, 'B', false));
- $this->assertTrue(Arr::keyExists($arr, 'b', false));
- }
- public function testArrGetCaseInsensitive()
- {
- $arr = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
- $this->assertNull(Arr::get($arr, 'd'));
- $this->assertSame('b', Arr::get($arr, 'B'));
- $this->assertSame('b', Arr::get($arr, 'b'));
- }
- public function testArrExistsCaseSensitive()
- {
- $arr = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
- $this->assertNull(Arr::get($arr, 'd', false));
- $this->assertNull(Arr::get($arr, 'B', false));
- $this->assertSame('b', Arr::get($arr, 'b', false));
- }
- }
|