DataSift\Storyplayer\Output::usePluginInSlot PHP Method

usePluginInSlot() public method

set the plugin for a named output slot
public usePluginInSlot ( OutputPlugin $plugin, string $slotName )
$plugin DataSift\Storyplayer\OutputLib\OutputPlugin the plugin to use in the slot
$slotName string the name of the slot to use for this plugin
    public function usePluginInSlot(OutputPlugin $plugin, $slotName)
    {
        // enforce our inputs
        Contract::RequiresValue($slotName, is_string($slotName));
        // put the plugin in the required slot
        $this->plugins[$slotName] = $plugin;
    }

Usage Example

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