Skip to content

Commit

Permalink
Fix Undefined index: year in vendor/lavary/crunz/src/Event.php (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
mindcreations authored and PabloKowalczyk committed Jun 15, 2018
1 parent bae0601 commit 634be46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ public function on($date)
$segments = \array_only($date, \array_flip($this->fieldsPosition));

if ($date['year']) {
$this->skip(function () use ($segments) {
return (int) date('Y') != $segments['year'];
$this->skip(function () use ($date) {
return (int) date('Y') != $date['year'];
});
}

Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ public function testIsDue()
$e = new Event($this->id, 'php bar');
$this->assertEquals('0 19 * * 6 *', $e->saturdays()->at('19:00')->timezone('EST')->getExpression());
$this->assertTrue($e->isDue($timezone));

$e = new Event($this->id, 'php bar');
Carbon::setTestNow(Carbon::create(\date('Y'), 4, 12, 0, 0, 0));
$this->assertTrue($e->on('00:00 ' . \date('Y') . '-04-12')->isDue($timezone));
}

public function testName()
Expand Down

0 comments on commit 634be46

Please sign in to comment.