DataSift\Storyplayer\Output::logPhaseSkipped PHP Method

logPhaseSkipped() public method

called when a story is skipped
public logPhaseSkipped ( string $phaseName, string $msg ) : void
$phaseName string the name of the phase where the error occurred
$msg string an informational message to send to console|logfile
return void
    public function logPhaseSkipped($phaseName, $msg)
    {
        // enforce our inputs
        Contract::RequiresValue($phaseName, is_string($phaseName));
        Contract::RequiresValue($msg, is_string($msg));
        // keep track of what was attempted, in case we need to show
        // the user what was attempted
        $this->activityLog[] = ['ts' => time(), 'text' => $msg, 'codeLine' => null];
        // call all of our plugins
        foreach ($this->plugins as $plugin) {
            $plugin->logPhaseSkipped($phaseName, $msg);
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @covers DataSift\Storyplayer\Output::logPhaseSkipped()
  */
 public function testCanLogPhaseSkipped()
 {
     // ----------------------------------------------------------------
     // setup the test
     $phaseName = "a unit-test";
     $msg = "we interrupt your regular entertainment because we are skipping over it ;)";
     $plugin1 = Mockery::mock("DataSift\\Storyplayer\\OutputLib\\OutputPlugin");
     $plugin1->shouldReceive('logPhaseSkipped')->once()->with($phaseName, $msg);
     $plugin2 = Mockery::mock("DataSift\\Storyplayer\\OutputLib\\OutputPlugin");
     $plugin2->shouldReceive('logPhaseSkipped')->once()->with($phaseName, $msg);
     $obj = new Output();
     $obj->usePluginInSlot($plugin1, "console");
     $obj->usePluginInSlot($plugin2, "slot1");
     // ----------------------------------------------------------------
     // perform the change
     $obj->logPhaseSkipped($phaseName, $msg);
     // ----------------------------------------------------------------
     // test the results
     Mockery::close();
 }