Skip to content

Instantly share code, notes, and snippets.

@zlikavac32
Last active September 7, 2017 10:31
Show Gist options
  • Select an option

  • Save zlikavac32/cca9057e52404b0f5672855829861245 to your computer and use it in GitHub Desktop.

Select an option

Save zlikavac32/cca9057e52404b0f5672855829861245 to your computer and use it in GitHub Desktop.
<?php
//...
public function testThatOnMondayItWorks(): void {
try {
timecop_travel(new DateTime('2017-08-28 00:00:00')); //Monday
$output = $this->runCommand('some-command');
$this->assertContains('OK', $output);
} finally {
timecop_return();
}
}
public function testThatOnTuesdayItDoesNotWork(): void {
try {
timecop_travel(new DateTime('2017-08-29 00:00:00')); //Tuesday
$output = $this->runCommand('some-command');
$this->assertContains('Error', $output);
} finally {
timecop_return();
}
}
//and if you want to be sure, for all other days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment