/** * @covers Veles\Tools\CliProgressBar::getMemString */ public function testGetMemString() { $reflection = new \ReflectionClass($this->object); $mem_usage_func_prop = $reflection->getProperty('mem_usage_func'); $mem_usage_func_prop->setAccessible(true); $mem_usage_func_prop->setValue($this->object, '\\Veles\\Tests\\Tools\\fake_mem_usage'); $mem_peak_func_prop = $reflection->getProperty('mem_peak_func'); $mem_peak_func_prop->setAccessible(true); $mem_peak_func_prop->setValue($this->object, '\\Veles\\Tests\\Tools\\fake_mem_peak_usage'); $expected = " | Mem: 195.48 KB | Max: 215.12 KB"; $result = $this->object->getMemString(); $msg = 'CliProgressBar::getMemString() returns wrong result!'; $this->assertSame($expected, $result, $msg); }