Skip to content

Commit

Permalink
added 2 simple tests for array_wrap() and Arr::wrap helper functions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
edenreich authored and taylorotwell committed Mar 18, 2017
1 parent 0607db0 commit ef12706
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,4 +522,15 @@ public function testForget()
Arr::forget($array, ['emails.joe@example.com', 'emails.jane@localhost']);
$this->assertEquals(['emails' => ['joe@example.com' => ['name' => 'Joe']]], $array);
}

public function testWrap()
{
$string = 'a';
$array = ['a'];
$object = new stdClass;
$object->value = 'a';
$this->assertEquals(['a'], array_wrap($string));
$this->assertEquals($array, array_wrap($array));
$this->assertEquals([$object], array_wrap($object));
}
}
11 changes: 11 additions & 0 deletions tests/Support/SupportHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,17 @@ function ($value, $key) {
));
}

public function testArrayWrap()
{
$string = 'a';
$array = ['a'];
$object = new stdClass;
$object->value = 'a';
$this->assertEquals(['a'], array_wrap($string));
$this->assertEquals($array, array_wrap($array));
$this->assertEquals([$object], array_wrap($object));
}

public function testHead()
{
$array = ['a', 'b', 'c'];
Expand Down

0 comments on commit ef12706

Please sign in to comment.