Просмотр исходного кода

Add test for array macros provider

Mr. CaT 1 год назад
Родитель
Сommit
cc266262ae
1 измененных файлов с 35 добавлено и 0 удалено
  1. 35 0
      tests/Unit/ArrayMacrosTest.php

+ 35 - 0
tests/Unit/ArrayMacrosTest.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace Tests\Unit;
+
+use App\Providers\Macros\ArrayProvider;
+use Illuminate\Support\Arr;
+use Illuminate\Support\Facades\App;
+// use PHPUnit\Framework\TestCase;
+use Tests\TestCase;
+
+class ArrayMacrosTest extends TestCase
+{
+    /**
+     * A basic unit test example.
+     */
+    public function test_array_has_nested_keys(): void
+    {
+        $array = [
+            [
+                'id' => 1,
+                'name' => 'Taras',
+                'age' => 25
+            ],
+            [
+                'id' => 2,
+                'name' => 'Erlang',
+                'age' => 30
+            ]
+        ];
+
+        $response = Arr::hasNestedKey('id', $array);
+
+        $this->assertEquals(true, $response);
+    }
+}