Skip to content

Commit c8dabaa

Browse files
committed
ITT: Laravel 5.1 support.
1 parent a05c9e3 commit c8dabaa

File tree

4 files changed

+5
-27
lines changed

4 files changed

+5
-27
lines changed

src/Asserts/DatabaseAsserts.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,17 @@ protected function dontSeeDatabaseTable($table)
1818

1919
protected function seeInDatabaseMany($table, array $rows)
2020
{
21-
/* @laravel-versions */
22-
$assert = method_exists($this, 'assertDatabaseHas') ? 'assertDatabaseHas' : 'seeInDatabase';
23-
2421
foreach ($rows as $row) {
25-
$this->$assert($table, $row);
22+
$this->seeInDatabase($table, $row);
2623
}
2724

2825
return $this;
2926
}
3027

3128
protected function dontSeeInDatabaseMany($table, array $rows)
3229
{
33-
/* @laravel-versions */
34-
$assert = method_exists($this, 'assertDatabaseMissing') ? 'assertDatabaseMissing' : 'dontSeeInDatabase';
35-
3630
foreach ($rows as $row) {
37-
$this->$assert($table, $row);
31+
$this->dontSeeInDatabase($table, $row);
3832
}
3933

4034
return $this;

src/Asserts/EloquentAsserts.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ protected function assertEloquentHasMany($class, $relation)
7777
$parentKey = $hasManyRelation->getParent()->getKeyName();
7878
$childModel = $hasManyRelation->getRelated();
7979
$childKey = $childModel->getKeyName();
80-
81-
/* @laravel-versions */
82-
$childForeignKey = method_exists($hasManyRelation, 'getForeignKeyName')
83-
? $hasManyRelation->getForeignKeyName() : last(explode('.', $hasManyRelation->getForeignKey()));
80+
$childForeignKey = last(explode('.', $hasManyRelation->getForeignKey()));
8481

8582
$parent = factory($class)->create();
8683
$children = factory(get_class($childModel), 3)->create([$childForeignKey => $parent->{$parentKey}]);
@@ -127,9 +124,7 @@ protected function assertEloquentHasCreateManyFor($class, $relation, $createMany
127124
->make()
128125
->toArray()
129126
);
130-
131-
/* @laravel-versions */
132-
$children = is_array($children) ? collect($children) : $children;
127+
$children = collect($children);
133128

134129
$this->assertCollectionsEqual($children, $parent->{$relation}, $childKey);
135130
}

src/Asserts/ScheduleAsserts.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ protected function seeInSchedule($command, $expression, $runInBackground = false
3030
$message = "Failed asserting that command `{$command}` is in schedule as `{$expression}`.";
3131
$expression = $this->normalizeScheduleExpression(clone $event, $expression);
3232
$this->assertEquals($expression, $event->expression, $message);
33-
34-
/* @laravel-versions */
35-
if (isset($event->runInBackground)) {
36-
$message = "Failed asserting that command `{$command}` is scheduled with the same `run in background` mode.";
37-
$this->assertEquals($runInBackground, $event->runInBackground, $message);
38-
}
3933
}
4034

4135
protected function dontSeeInSchedule($command)

tests/TestingTools/Asserts/ScheduleAssertsTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ private function createSampleSchedule()
2222
$schedule->command('foo')->everyFiveMinutes();
2323
$schedule->command('bar')->hourly();
2424

25-
$baz = $schedule->command('baz')->twiceDaily();
26-
27-
/* @laravel-versions */
28-
if (method_exists($baz, 'runInBackground')) {
29-
$baz->runInBackground();
30-
}
25+
$schedule->command('baz')->twiceDaily();
3126
});
3227
}
3328

0 commit comments

Comments
 (0)