Skip to content

Commit dcebf75

Browse files
lucasmichotLucas Michot
andauthored
Flip misordered assertions arguments (#59691)
Co-authored-by: Lucas Michot <lucas@zaiple.com>
1 parent 06e994e commit dcebf75

30 files changed

Lines changed: 154 additions & 154 deletions

tests/Config/RepositoryTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function setUp(): void
5252
public function testGetValueWhenKeyContainDot()
5353
{
5454
$this->assertSame(
55-
$this->repository->get('a.b'), 'c'
55+
'c', $this->repository->get('a.b')
5656
);
5757
$this->assertNull(
5858
$this->repository->get('a.b.c')
@@ -308,7 +308,7 @@ public function testItThrowsAnExceptionWhenTryingToGetNonStringValueAsString():
308308
public function testItGetsAsArray(): void
309309
{
310310
$this->assertSame(
311-
$this->repository->array('array'), ['aaa', 'zzz']
311+
['aaa', 'zzz'], $this->repository->array('array')
312312
);
313313
}
314314

@@ -346,7 +346,7 @@ public function testItThrowsAnExceptionWhenTryingToGetNonBooleanValueAsBoolean()
346346
public function testItGetsAsInteger(): void
347347
{
348348
$this->assertSame(
349-
$this->repository->integer('integer'), 1
349+
1, $this->repository->integer('integer')
350350
);
351351
}
352352

@@ -361,7 +361,7 @@ public function testItThrowsAnExceptionWhenTryingToGetNonIntegerValueAsInteger()
361361
public function testItGetsAsFloat(): void
362362
{
363363
$this->assertSame(
364-
$this->repository->float('float'), 1.1
364+
1.1, $this->repository->float('float')
365365
);
366366
}
367367

tests/Container/ContainerResolveNonInstantiableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testResolveVariadicPrimitive()
2929
$container = new Container;
3030
$parent = $container->make(VariadicPrimitive::class);
3131

32-
$this->assertSame($parent->params, []);
32+
$this->assertSame([], $parent->params);
3333
}
3434
}
3535

tests/Database/DatabaseEloquentFactoryTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,15 +628,15 @@ public function test_sequence_with_has_many_relationship()
628628
$this->assertCount(6, FactoryTestPost::all());
629629
$this->assertCount(3, FactoryTestUser::latest()->first()->posts);
630630
$this->assertEquals(
631-
FactoryTestPost::orderBy('title')->pluck('title')->all(),
632631
[
633632
'Abigail Otwell Post 1',
634633
'Abigail Otwell Post 2',
635634
'Abigail Otwell Post 3',
636635
'Taylor Otwell Post 1',
637636
'Taylor Otwell Post 2',
638637
'Taylor Otwell Post 3',
639-
]
638+
],
639+
FactoryTestPost::orderBy('title')->pluck('title')->all()
640640
);
641641
}
642642

@@ -999,8 +999,8 @@ public function test_can_default_to_without_parents()
999999

10001000
public function test_factory_model_names_correct()
10011001
{
1002-
$this->assertEquals(FactoryTestUseFactoryAttribute::factory()->modelName(), FactoryTestUseFactoryAttribute::class);
1003-
$this->assertEquals(FactoryTestGuessModel::factory()->modelName(), FactoryTestGuessModel::class);
1002+
$this->assertEquals(FactoryTestUseFactoryAttribute::class, FactoryTestUseFactoryAttribute::factory()->modelName());
1003+
$this->assertEquals(FactoryTestGuessModel::class, FactoryTestGuessModel::factory()->modelName());
10041004
}
10051005

10061006
public function test_factory_global_model_resolver()
@@ -1009,11 +1009,11 @@ public function test_factory_global_model_resolver()
10091009
return __NAMESPACE__.'\\'.Str::replaceLast('Factory', '', class_basename($factory::class));
10101010
});
10111011

1012-
$this->assertEquals(FactoryTestGuessModel::factory()->modelName(), FactoryTestGuessModel::class);
1013-
$this->assertEquals(FactoryTestUseFactoryAttribute::factory()->modelName(), FactoryTestUseFactoryAttribute::class);
1012+
$this->assertEquals(FactoryTestGuessModel::class, FactoryTestGuessModel::factory()->modelName());
1013+
$this->assertEquals(FactoryTestUseFactoryAttribute::class, FactoryTestUseFactoryAttribute::factory()->modelName());
10141014

1015-
$this->assertEquals(FactoryTestUseFactoryAttributeFactory::new()->modelName(), FactoryTestUseFactoryAttribute::class);
1016-
$this->assertEquals(FactoryTestGuessModelFactory::new()->modelName(), FactoryTestGuessModel::class);
1015+
$this->assertEquals(FactoryTestUseFactoryAttribute::class, FactoryTestUseFactoryAttributeFactory::new()->modelName());
1016+
$this->assertEquals(FactoryTestGuessModel::class, FactoryTestGuessModelFactory::new()->modelName());
10171017
}
10181018

10191019
public function test_factory_model_has_many_relationship_has_pending_attributes()

tests/Database/DatabaseEloquentHasManyThroughIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function testWithWhereHasOnARelationWithCustomIntermediateAndLocalKey()
132132

133133
$this->assertCount(1, $country);
134134
$this->assertTrue($country->first()->relationLoaded('posts'));
135-
$this->assertEquals($country->first()->posts->pluck('title')->unique()->toArray(), ['A title']);
135+
$this->assertEquals(['A title'], $country->first()->posts->pluck('title')->unique()->toArray());
136136
}
137137

138138
public function testFindMethod()

tests/Database/DatabaseEloquentHasOneThroughIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function testWithWhereHasOnARelationWithCustomIntermediateAndLocalKey()
127127

128128
$this->assertCount(1, $position);
129129
$this->assertTrue($position->first()->relationLoaded('contract'));
130-
$this->assertEquals($position->first()->contract->pluck('title')->unique()->toArray(), ['A title']);
130+
$this->assertEquals(['A title'], $position->first()->contract->pluck('title')->unique()->toArray());
131131
}
132132

133133
public function testFirstOrFailThrowsAnException()

tests/Database/DatabaseEloquentIntegrationTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ public function testWithWhereHasOnSelfReferencingBelongsToManyRelationship()
12051205
$this->assertCount(1, $results);
12061206
$this->assertSame('taylorotwell@gmail.com', $results->first()->email);
12071207
$this->assertTrue($results->first()->relationLoaded('friends'));
1208-
$this->assertSame($results->first()->friends->pluck('email')->unique()->toArray(), ['abigailotwell@gmail.com']);
1208+
$this->assertSame(['abigailotwell@gmail.com'], $results->first()->friends->pluck('email')->unique()->toArray());
12091209
}
12101210

12111211
public function testHasOnNestedSelfReferencingBelongsToManyRelationship()
@@ -1247,8 +1247,8 @@ public function testWithWhereHasOnNestedSelfReferencingBelongsToManyRelationship
12471247
$this->assertCount(1, $results);
12481248
$this->assertSame('taylorotwell@gmail.com', $results->first()->email);
12491249
$this->assertTrue($results->first()->relationLoaded('friends'));
1250-
$this->assertSame($results->first()->friends->pluck('email')->unique()->toArray(), ['abigailotwell@gmail.com']);
1251-
$this->assertSame($results->first()->friends->pluck('friends')->flatten()->pluck('email')->unique()->toArray(), ['foo@gmail.com']);
1250+
$this->assertSame(['abigailotwell@gmail.com'], $results->first()->friends->pluck('email')->unique()->toArray());
1251+
$this->assertSame(['foo@gmail.com'], $results->first()->friends->pluck('friends')->flatten()->pluck('email')->unique()->toArray());
12521252
}
12531253

12541254
public function testHasOnSelfReferencingBelongsToManyRelationshipWithWherePivot()
@@ -1321,7 +1321,7 @@ public function testWithWhereHasOnSelfReferencingBelongsToRelationship()
13211321
$this->assertCount(1, $results);
13221322
$this->assertSame('Child Post', $results->first()->name);
13231323
$this->assertTrue($results->first()->relationLoaded('parentPost'));
1324-
$this->assertSame($results->first()->parentPost->name, 'Parent Post');
1324+
$this->assertSame('Parent Post', $results->first()->parentPost->name);
13251325
}
13261326

13271327
public function testHasOnNestedSelfReferencingBelongsToRelationship()
@@ -1363,9 +1363,9 @@ public function testWithWhereHasOnNestedSelfReferencingBelongsToRelationship()
13631363
$this->assertCount(1, $results);
13641364
$this->assertSame('Child Post', $results->first()->name);
13651365
$this->assertTrue($results->first()->relationLoaded('parentPost'));
1366-
$this->assertSame($results->first()->parentPost->name, 'Parent Post');
1366+
$this->assertSame('Parent Post', $results->first()->parentPost->name);
13671367
$this->assertTrue($results->first()->parentPost->relationLoaded('parentPost'));
1368-
$this->assertSame($results->first()->parentPost->parentPost->name, 'Grandparent Post');
1368+
$this->assertSame('Grandparent Post', $results->first()->parentPost->parentPost->name);
13691369
}
13701370

13711371
public function testHasOnSelfReferencingHasManyRelationship()
@@ -1404,7 +1404,7 @@ public function testWithWhereHasOnSelfReferencingHasManyRelationship()
14041404
$this->assertCount(1, $results);
14051405
$this->assertSame('Parent Post', $results->first()->name);
14061406
$this->assertTrue($results->first()->relationLoaded('childPosts'));
1407-
$this->assertSame($results->first()->childPosts->pluck('name')->unique()->toArray(), ['Child Post']);
1407+
$this->assertSame(['Child Post'], $results->first()->childPosts->pluck('name')->unique()->toArray());
14081408
}
14091409

14101410
public function testHasOnNestedSelfReferencingHasManyRelationship()
@@ -1446,8 +1446,8 @@ public function testWithWhereHasOnNestedSelfReferencingHasManyRelationship()
14461446
$this->assertCount(1, $results);
14471447
$this->assertSame('Grandparent Post', $results->first()->name);
14481448
$this->assertTrue($results->first()->relationLoaded('childPosts'));
1449-
$this->assertSame($results->first()->childPosts->pluck('name')->unique()->toArray(), ['Parent Post']);
1450-
$this->assertSame($results->first()->childPosts->pluck('childPosts')->flatten()->pluck('name')->unique()->toArray(), ['Child Post']);
1449+
$this->assertSame(['Parent Post'], $results->first()->childPosts->pluck('name')->unique()->toArray());
1450+
$this->assertSame(['Child Post'], $results->first()->childPosts->pluck('childPosts')->flatten()->pluck('name')->unique()->toArray());
14511451
}
14521452

14531453
public function testHasWithNonWhereBindings()

tests/Database/DatabaseEloquentModelTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,8 +3138,8 @@ public function testMergeCastsMergesCastsUsingArrays()
31383138

31393139
$this->assertCount($castCount + 2, $model->getCasts());
31403140
$this->assertArrayHasKey('foo', $model->getCasts());
3141-
$this->assertEquals($model->getCasts()['foo'], 'MyClass:myArgumentA');
3142-
$this->assertEquals($model->getCasts()['bar'], 'MyClass:myArgumentA,myArgumentB');
3141+
$this->assertEquals('MyClass:myArgumentA', $model->getCasts()['foo']);
3142+
$this->assertEquals('MyClass:myArgumentA,myArgumentB', $model->getCasts()['bar']);
31433143
}
31443144

31453145
public function testUnsetCastAttributes()

tests/Database/DatabaseMigrationCreatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testBasicCreateMethodCallsPostCreateHooks()
4747
$creator->create('create_bar', 'foo', $table);
4848

4949
$this->assertEquals($_SERVER['__migration.creator.table'], $table);
50-
$this->assertEquals($_SERVER['__migration.creator.path'], 'foo/foo_create_bar.php');
50+
$this->assertEquals('foo/foo_create_bar.php', $_SERVER['__migration.creator.path']);
5151

5252
unset($_SERVER['__migration.creator.table'], $_SERVER['__migration.creator.path']);
5353
}

tests/Filesystem/FilesystemAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ public function testGetAllFiles()
677677

678678
$filesystemAdapter = new FilesystemAdapter($this->filesystem, $this->adapter);
679679

680-
$this->assertSame($filesystemAdapter->files(), ['body.txt', 'existing.txt', 'file.txt', 'file1.txt']);
680+
$this->assertSame(['body.txt', 'existing.txt', 'file.txt', 'file1.txt'], $filesystemAdapter->files());
681681
}
682682

683683
public function testProvidesTemporaryUrls()

tests/Filesystem/FilesystemManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function testCanBuildInlineScopedDisks()
209209

210210
$scoped->put('dirname/filename.txt', 'file content');
211211
$this->assertTrue(is_dir(__DIR__.'/../../to-be-scoped/path-prefix'));
212-
$this->assertEquals(file_get_contents(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt'), 'file content');
212+
$this->assertEquals('file content', file_get_contents(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt'));
213213
} finally {
214214
unlink(__DIR__.'/../../to-be-scoped/path-prefix/dirname/filename.txt');
215215
rmdir(__DIR__.'/../../to-be-scoped/path-prefix/dirname');

0 commit comments

Comments
 (0)