public function testCreateNewMetric() { $diObj = new DI(); $expectedMetric = new Metric(); $expectedMetric->setName('MemoryUsage'); $expectedMetric->setUnit('Percent'); $expectedMetric->setValue('56'); $expectedMetric->setNamespace('CustomMetric/Test'); /* @var CommandRunner $fakeCmdRunner */ $fakeCmdRunner = Stub::make('\\AWSCustomMetric\\CommandRunner', ['execute' => function () { }, 'getReturnCode' => 0, 'getReturnValue' => '56']); $diObj->setCommandRunner($fakeCmdRunner); $memUsage = new MemoryUsage($diObj, 'CustomMetric/Test'); $this->assertEquals($expectedMetric, $memUsage->createNewMetric('MemoryUsage', 'Percent', '56'), 'MemoryUsage::createNewMetric test failed!'); }