public function testAddingTwoRunnersFromArray() { $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->addRunners([$runnerMockOne, $runnerMockTwo]); $this->assertEquals($resultTwo, $this->instance->run($commandMock)); }
#!/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);