示例#1
0
 public function testAddingTwoRunners()
 {
     $commandMock = M::mock('Steam\\Command\\CommandInterface');
     $resultOne = 'called';
     $resultTwo = 'called second';
     $runnerMockOne = M::mock('Steam\\Runner\\RunnerInterface');
     $runnerMockOne->shouldReceive('setConfig')->with($this->config)->andReturnSelf()->once();
     $runnerMockOne->shouldReceive('run')->with($commandMock, null)->andReturn($resultOne)->once();
     $runnerMockTwo = M::mock('Steam\\Runner\\RunnerInterface');
     $runnerMockTwo->shouldReceive('setConfig')->with($this->config)->andReturnSelf()->once();
     $runnerMockTwo->shouldReceive('run')->with($commandMock, $resultOne)->andReturn($resultTwo)->once();
     $this->instance->addRunner($runnerMockOne);
     $this->instance->addRunner($runnerMockTwo);
     $this->assertEquals($resultTwo, $this->instance->run($commandMock));
 }
示例#2
0
#!/usr/bin/env php
<?php 
include_once __DIR__ . '/../vendor/autoload.php';
use GuzzleHttp\Client;
use Steam\Configuration;
use Steam\Runner\GuzzleRunner;
use Steam\Runner\DecodeJsonStringRunner;
use Steam\Steam;
use Steam\Utility\GuzzleUrlBuilder;
$steam = new Steam(new Configuration());
$steam->addRunner(new GuzzleRunner(new Client(), new GuzzleUrlBuilder()));
$steam->addRunner(new DecodeJsonStringRunner());
/** @var array $result */
$result = $steam->run(new \Steam\Command\Apps\GetAppList());
var_dump($result);