Skip to content

Commit 6098ee9

Browse files
committed
Use toArray() instead of all() in tests
1 parent 13bf41c commit 6098ee9

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

tests/MapTest.php

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testAfterCallback()
7171
public function testAll()
7272
{
7373
$m = new Map( ['name' => 'Hello'] );
74-
$this->assertSame( ['name' => 'Hello'], $m->all() );
74+
$this->assertSame( ['name' => 'Hello'], $m->toArray() );
7575
}
7676

7777

@@ -265,12 +265,12 @@ public function testCall()
265265

266266
public function testCast()
267267
{
268-
$this->assertEquals( ['1', '1', '1', 'yes'], Map::from( [true, 1, 1.0, 'yes'] )->cast()->all() );
269-
$this->assertEquals( [true, true, true, true], Map::from( [true, 1, 1.0, 'yes'] )->cast( 'bool' )->all() );
270-
$this->assertEquals( [1, 1, 1, 0], Map::from( [true, 1, 1.0, 'yes'] )->cast( 'int' )->all() );
271-
$this->assertEquals( [1.0, 1.0, 1.0, 0.0], Map::from( [true, 1, 1.0, 'yes'] )->cast( 'float' )->all() );
272-
$this->assertEquals( [[], []], Map::from( [new \stdClass, new \stdClass] )->cast( 'array' )->all() );
273-
$this->assertEquals( [new \stdClass, new \stdClass], Map::from( [[], []] )->cast( 'object' )->all() );
268+
$this->assertEquals( ['1', '1', '1', 'yes'], Map::from( [true, 1, 1.0, 'yes'] )->cast()->toArray() );
269+
$this->assertEquals( [true, true, true, true], Map::from( [true, 1, 1.0, 'yes'] )->cast( 'bool' )->toArray() );
270+
$this->assertEquals( [1, 1, 1, 0], Map::from( [true, 1, 1.0, 'yes'] )->cast( 'int' )->toArray() );
271+
$this->assertEquals( [1.0, 1.0, 1.0, 0.0], Map::from( [true, 1, 1.0, 'yes'] )->cast( 'float' )->toArray() );
272+
$this->assertEquals( [[], []], Map::from( [new \stdClass, new \stdClass] )->cast( 'array' )->toArray() );
273+
$this->assertEquals( [new \stdClass, new \stdClass], Map::from( [[], []] )->cast( 'object' )->toArray() );
274274
}
275275

276276

@@ -1478,7 +1478,7 @@ function( Map $_ ) { return ['b']; }
14781478
);
14791479

14801480
$this->assertInstanceOf( Map::class, $r );
1481-
$this->assertSame( ['b'], $r->all() );
1481+
$this->assertSame( ['b'], $r->toArray() );
14821482
}
14831483

14841484

@@ -1491,7 +1491,7 @@ function( Map $_ ) { $this->assertTrue( false ); }
14911491
);
14921492

14931493
$this->assertInstanceOf( Map::class, $r );
1494-
$this->assertSame( [], $r->all() );
1494+
$this->assertSame( [], $r->toArray() );
14951495
}
14961496

14971497

@@ -1504,7 +1504,7 @@ function( Map $_ ) { $this->assertTrue( true ); }
15041504
);
15051505

15061506
$this->assertInstanceOf( Map::class, $r );
1507-
$this->assertSame( [], $r->all() );
1507+
$this->assertSame( [], $r->toArray() );
15081508
}
15091509

15101510

@@ -1515,7 +1515,7 @@ public function testIfTrue()
15151515
} );
15161516

15171517
$this->assertInstanceOf( Map::class, $r );
1518-
$this->assertSame( ['a', 'b', 'c'], $r->all() );
1518+
$this->assertSame( ['a', 'b', 'c'], $r->toArray() );
15191519
}
15201520

15211521

@@ -1526,7 +1526,7 @@ public function testIfFalse()
15261526
} );
15271527

15281528
$this->assertInstanceOf( Map::class, $r );
1529-
$this->assertSame( ['b'], $r->all() );
1529+
$this->assertSame( ['b'], $r->toArray() );
15301530
}
15311531

15321532

@@ -1537,7 +1537,7 @@ function( Map $_ ) { return ['b']; }
15371537
);
15381538

15391539
$this->assertInstanceOf( Map::class, $r );
1540-
$this->assertSame( ['b'], $r->all() );
1540+
$this->assertSame( ['b'], $r->toArray() );
15411541
}
15421542

15431543

@@ -1549,7 +1549,7 @@ function( Map $m ) { return $m->push( 'c' ); }
15491549
);
15501550

15511551
$this->assertInstanceOf( Map::class, $r );
1552-
$this->assertSame( ['c'], $r->all() );
1552+
$this->assertSame( ['c'], $r->toArray() );
15531553
}
15541554

15551555

@@ -1558,7 +1558,7 @@ public function testIfAnyNone()
15581558
$r = Map::from( ['a'] )->ifAny();
15591559

15601560
$this->assertInstanceOf( Map::class, $r );
1561-
$this->assertSame( ['a'], $r->all() );
1561+
$this->assertSame( ['a'], $r->toArray() );
15621562
}
15631563

15641564

@@ -3088,27 +3088,27 @@ public function testSpliceAll()
30883088

30893089
public function testStrAfter()
30903090
{
3091-
$this->assertEquals( ['1', '1', '1'], Map::from( [1, 1.0, true, ['x'], new \stdClass] )->strAfter( '' )->all() );
3092-
$this->assertEquals( ['0', '0'], Map::from( [0, 0.0, false, []] )->strAfter( '' )->all() );
3093-
$this->assertEquals( ['üß'], Map::from( ['äöüß'] )->strAfter( 'ö' )->all() );
3094-
$this->assertEquals( ['abc'], Map::from( ['abc'] )->strAfter( '' )->all() );
3095-
$this->assertEquals( ['c'], Map::from( ['abc'] )->strAfter( 'b' )->all() );
3096-
$this->assertEquals( [''], Map::from( ['abc'] )->strAfter( 'c' )->all() );
3097-
$this->assertEquals( [], Map::from( ['abc'] )->strAfter( 'x' )->all() );
3098-
$this->assertEquals( [], Map::from( [''] )->strAfter( '' )->all() );
3091+
$this->assertEquals( ['1', '1', '1'], Map::from( [1, 1.0, true, ['x'], new \stdClass] )->strAfter( '' )->toArray() );
3092+
$this->assertEquals( ['0', '0'], Map::from( [0, 0.0, false, []] )->strAfter( '' )->toArray() );
3093+
$this->assertEquals( ['üß'], Map::from( ['äöüß'] )->strAfter( 'ö' )->toArray() );
3094+
$this->assertEquals( ['abc'], Map::from( ['abc'] )->strAfter( '' )->toArray() );
3095+
$this->assertEquals( ['c'], Map::from( ['abc'] )->strAfter( 'b' )->toArray() );
3096+
$this->assertEquals( [''], Map::from( ['abc'] )->strAfter( 'c' )->toArray() );
3097+
$this->assertEquals( [], Map::from( ['abc'] )->strAfter( 'x' )->toArray() );
3098+
$this->assertEquals( [], Map::from( [''] )->strAfter( '' )->toArray() );
30993099
}
31003100

31013101

31023102
public function testStrBefore()
31033103
{
3104-
$this->assertEquals( ['1', '1', '1'], Map::from( [1, 1.0, true, ['x'], new \stdClass] )->strBefore( '' )->all() );
3105-
$this->assertEquals( ['0', '0'], Map::from( [0, 0.0, false, []] )->strBefore( '' )->all() );
3106-
$this->assertEquals( ['äö'], Map::from( ['äöüß'] )->strBefore( 'ü' )->all() );
3107-
$this->assertEquals( ['abc'], Map::from( ['abc'] )->strBefore( '' )->all() );
3108-
$this->assertEquals( ['a'], Map::from( ['abc'] )->strBefore( 'b' )->all() );
3109-
$this->assertEquals( [''], Map::from( ['abc'] )->strBefore( 'a' )->all() );
3110-
$this->assertEquals( [], Map::from( ['abc'] )->strBefore( 'x' )->all() );
3111-
$this->assertEquals( [], Map::from( [''] )->strBefore( '' )->all() );
3104+
$this->assertEquals( ['1', '1', '1'], Map::from( [1, 1.0, true, ['x'], new \stdClass] )->strBefore( '' )->toArray() );
3105+
$this->assertEquals( ['0', '0'], Map::from( [0, 0.0, false, []] )->strBefore( '' )->toArray() );
3106+
$this->assertEquals( ['äö'], Map::from( ['äöüß'] )->strBefore( 'ü' )->toArray() );
3107+
$this->assertEquals( ['abc'], Map::from( ['abc'] )->strBefore( '' )->toArray() );
3108+
$this->assertEquals( ['a'], Map::from( ['abc'] )->strBefore( 'b' )->toArray() );
3109+
$this->assertEquals( [''], Map::from( ['abc'] )->strBefore( 'a' )->toArray() );
3110+
$this->assertEquals( [], Map::from( ['abc'] )->strBefore( 'x' )->toArray() );
3111+
$this->assertEquals( [], Map::from( [''] )->strBefore( '' )->toArray() );
31123112
}
31133113

31143114

@@ -3186,15 +3186,15 @@ public function testStrEndsAll()
31863186

31873187
public function testStrLower()
31883188
{
3189-
$this->assertEquals( ["my string"], Map::from( ['My String'] )->strLower()->all() );
3190-
$this->assertEquals( ["τάχιστη"], Map::from( ['Τάχιστη'] )->strLower()->all() );
3189+
$this->assertEquals( ["my string"], Map::from( ['My String'] )->strLower()->toArray() );
3190+
$this->assertEquals( ["τάχιστη"], Map::from( ['Τάχιστη'] )->strLower()->toArray() );
31913191

31923192
$list = [mb_convert_encoding( 'ÄPFEL', 'ISO-8859-1' ), 'BIRNEN'];
31933193
$expected = [mb_convert_encoding( 'äpfel', 'ISO-8859-1' ), "birnen"];
3194-
$this->assertEquals( $expected, Map::from( $list )->strLower( 'ISO-8859-1' )->all() );
3194+
$this->assertEquals( $expected, Map::from( $list )->strLower( 'ISO-8859-1' )->toArray() );
31953195

3196-
$this->assertEquals( [123], Map::from( [123] )->strLower()->all() );
3197-
$this->assertEquals( [new \stdClass], Map::from( [new \stdClass] )->strLower()->all() );
3196+
$this->assertEquals( [123], Map::from( [123] )->strLower()->toArray() );
3197+
$this->assertEquals( [new \stdClass], Map::from( [new \stdClass] )->strLower()->toArray() );
31983198
}
31993199

32003200

@@ -3217,15 +3217,15 @@ public function testString()
32173217

32183218
public function testStrUpper()
32193219
{
3220-
$this->assertEquals( ["MY STRING"], Map::from( ['My String'] )->strUpper()->all() );
3221-
$this->assertEquals( ["ΤΆΧΙΣΤΗ"], Map::from( ['τάχιστη'] )->strUpper()->all() );
3220+
$this->assertEquals( ["MY STRING"], Map::from( ['My String'] )->strUpper()->toArray() );
3221+
$this->assertEquals( ["ΤΆΧΙΣΤΗ"], Map::from( ['τάχιστη'] )->strUpper()->toArray() );
32223222

32233223
$list = [mb_convert_encoding( 'äpfel', 'ISO-8859-1' ), 'birnen'];
32243224
$expected = [mb_convert_encoding( 'ÄPFEL', 'ISO-8859-1' ), "BIRNEN"];
3225-
$this->assertEquals( $expected, Map::from( $list )->strUpper( 'ISO-8859-1' )->all() );
3225+
$this->assertEquals( $expected, Map::from( $list )->strUpper( 'ISO-8859-1' )->toArray() );
32263226

3227-
$this->assertEquals( [123], Map::from( [123] )->strUpper()->all() );
3228-
$this->assertEquals( [new \stdClass], Map::from( [new \stdClass] )->strUpper()->all() );
3227+
$this->assertEquals( [123], Map::from( [123] )->strUpper()->toArray() );
3228+
$this->assertEquals( [new \stdClass], Map::from( [new \stdClass] )->strUpper()->toArray() );
32293229
}
32303230

32313231

@@ -3244,13 +3244,13 @@ public function testStringException()
32443244

32453245
public function testStringReplace()
32463246
{
3247-
$this->assertEquals( ['google.de', 'aimeos.de'], Map::from( ['google.com', 'aimeos.com'] )->strReplace( '.com', '.de' )->all() );
3248-
$this->assertEquals( ['google.de', 'aimeos.de'], Map::from( ['google.com', 'aimeos.org'] )->strReplace( ['.com', '.org'], '.de' )->all() );
3249-
$this->assertEquals( ['google.de', 'aimeos'], Map::from( ['google.com', 'aimeos.org'] )->strReplace( ['.com', '.org'], ['.de'] )->all() );
3250-
$this->assertEquals( ['google.fr', 'aimeos.de'], Map::from( ['google.com', 'aimeos.org'] )->strReplace( ['.com', '.org'], ['.fr', '.de'] )->all() );
3251-
$this->assertEquals( ['google.de', 'aimeos.de'], Map::from( ['google.com', 'aimeos.com'] )->strReplace( ['.com', '.co'], ['.co', '.de', '.fr'] )->all() );
3252-
$this->assertEquals( ['google.de', 'aimeos.de', 123], Map::from( ['google.com', 'aimeos.com', 123] )->strReplace( '.com', '.de' )->all() );
3253-
$this->assertEquals( ['GOOGLE.de', 'AIMEOS.de'], Map::from( ['GOOGLE.COM', 'AIMEOS.COM'] )->strReplace( '.com', '.de', true )->all() );
3247+
$this->assertEquals( ['google.de', 'aimeos.de'], Map::from( ['google.com', 'aimeos.com'] )->strReplace( '.com', '.de' )->toArray() );
3248+
$this->assertEquals( ['google.de', 'aimeos.de'], Map::from( ['google.com', 'aimeos.org'] )->strReplace( ['.com', '.org'], '.de' )->toArray() );
3249+
$this->assertEquals( ['google.de', 'aimeos'], Map::from( ['google.com', 'aimeos.org'] )->strReplace( ['.com', '.org'], ['.de'] )->toArray() );
3250+
$this->assertEquals( ['google.fr', 'aimeos.de'], Map::from( ['google.com', 'aimeos.org'] )->strReplace( ['.com', '.org'], ['.fr', '.de'] )->toArray() );
3251+
$this->assertEquals( ['google.de', 'aimeos.de'], Map::from( ['google.com', 'aimeos.com'] )->strReplace( ['.com', '.co'], ['.co', '.de', '.fr'] )->toArray() );
3252+
$this->assertEquals( ['google.de', 'aimeos.de', 123], Map::from( ['google.com', 'aimeos.com', 123] )->strReplace( '.com', '.de' )->toArray() );
3253+
$this->assertEquals( ['GOOGLE.de', 'AIMEOS.de'], Map::from( ['GOOGLE.COM', 'AIMEOS.COM'] )->strReplace( '.com', '.de', true )->toArray() );
32543254
}
32553255

32563256

0 commit comments

Comments
 (0)