DataSift\Storyplayer\Output::logCliWarning PHP Method

logCliWarning() public method

called when the outer CLI shell needs to publish a warning
public logCliWarning ( string $msg ) : void
$msg string the warning message to show the user
return void
    public function logCliWarning($msg)
    {
        // enforce our inputs
        Contract::RequiresValue($msg, is_string($msg));
        // pass this on to our plugins
        foreach ($this->plugins as $plugin) {
            $plugin->logCliWarning($msg);
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @covers DataSift\Storyplayer\Output::logCliWarning()
  */
 public function testCanLogCliWarning()
 {
     // ----------------------------------------------------------------
     // setup the test
     $msg = "this might be an emergency, damnit!";
     $plugin1 = Mockery::mock("DataSift\\Storyplayer\\OutputLib\\OutputPlugin");
     $plugin1->shouldReceive('logCliWarning')->once()->with($msg);
     $plugin2 = Mockery::mock("DataSift\\Storyplayer\\OutputLib\\OutputPlugin");
     $plugin2->shouldReceive('logCliWarning')->once()->with($msg);
     $obj = new Output();
     $obj->usePluginInSlot($plugin1, "console");
     $obj->usePluginInSlot($plugin2, "slot1");
     // ----------------------------------------------------------------
     // perform the change
     $obj->logCliWarning($msg);
     // ----------------------------------------------------------------
     // test the results
     Mockery::close();
 }