Skip to content

Commit

Permalink
Merge pull request #43 from mokevnin/master
Browse files Browse the repository at this point in the history
Fix broken flatten and some other things
  • Loading branch information
aurimasniekis committed Dec 19, 2018
2 parents cea9a9d + 8c509a7 commit 3f01f3f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
5 changes: 5 additions & 0 deletions src/Tests/Collection/CollectionFlattenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public function dataCollectionFlatten()
['a', 'b', ['c', ['d']]],
];

$out[] = [
[['a'], 'b', ['c', 'd'], ['e', ['j']]],
['a', 'b', 'c', 'd', 'e', ['j']],
];

return $out;
}

Expand Down
12 changes: 6 additions & 6 deletions src/Tests/Collection/CollectionSizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class CollectionSizeTest extends \PHPUnit_Framework_TestCase
public function dataCollectionSize()
{
$out = [];
$out[] = [['a', 'b', 'c'], false, 3];
$out[] = [['a', 'b', ['c', 'd']], false, 3];
$out[] = [['a', 'b', ['c', 'd']], true, 5];
$out[] = [null, true, 0];
$out[] = [['fruits' => ['orange', 'banana', 'apple'], 'veggie' => ['carrot', 'collard', 'pea']], false, 2];
$out[] = [['fruits' => ['orange', 'banana', 'apple'], 'veggie' => ['carrot', 'collard', 'pea']], true, 8];
$out[] = [['a', 'b', 'c'], false, 3];
$out[] = [['a', 'b', ['c', 'd']], false, 3];
$out[] = [['a', 'b', ['c', 'd']], true, 5];
$out[] = [null, true, 0];
$out[] = [['fruits' => ['orange', 'banana', 'apple'], 'veggie' => ['carrot', 'collard', 'pea']], false, 2];
$out[] = [['fruits' => ['orange', 'banana', 'apple'], 'veggie' => ['carrot', 'collard', 'pea']], true, 8];

return $out;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Tests/Objects/AssignIfIssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Funct\Tests\Objects;

use Funct\Object;
use Funct\Object as Obj;

/**
* Class AssignIfIssetTest
Expand All @@ -18,13 +18,13 @@ public function testMethod()
$object = new \stdClass();
$array = [];

Object\assignIfIsset($object, 'foo', $array, 'bar');
Obj\assignIfIsset($object, 'foo', $array, 'bar');

$this->assertObjectNotHasAttribute('foo', $object);

$array = ['bar' => 'foobar'];

Object\assignIfIsset($object, 'foo', $array, 'bar');
Obj\assignIfIsset($object, 'foo', $array, 'bar');
$this->assertObjectHasAttribute('foo', $object);
$this->assertSame('foobar', $object->foo);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Tests/Objects/ObjectsToArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Funct\Tests\Objects;

use Funct\Object;
use Funct\Tests\Fixtures\SampleObject;;
use Funct\Object as Obj;
use Funct\Tests\Fixtures\SampleObject;

/**
* Class ObjectsToArrayTest
Expand Down Expand Up @@ -32,7 +32,7 @@ public function testObjectsToArray()

$expected = ['bar', 'bar', 'bar', 'bar'];

$this->assertEquals($expected, Object\toArray($objects, 'getFoo'));
$this->assertEquals($expected, Obj\toArray($objects, 'getFoo'));

$expected = [
'foo1' => 'bar',
Expand All @@ -41,6 +41,6 @@ public function testObjectsToArray()
'foo4' => 'bar',
];

$this->assertEquals($expected, Object\toArray($objects, 'getFoo', 'getBar'));
$this->assertEquals($expected, Obj\toArray($objects, 'getFoo', 'getBar'));
}
}

0 comments on commit 3f01f3f

Please sign in to comment.