/** * Runs the actual test. * * @param string $message * The second message to assert. * @param bool $memory_exceeded * Whether to test the memory exceeded case. * @param int|null $memory_usage_first * (optional) The first memory usage value. Defaults to NULL. * @param int|null $memory_usage_second * (optional) The fake amount of memory usage reported after memory reclaim. * Defaults to NULL. * @param int|null $memory_limit * (optional) The memory limit. Defaults to NULL. */ protected function runMemoryExceededTest($message, $memory_exceeded, $memory_usage_first = NULL, $memory_usage_second = NULL, $memory_limit = NULL) { $this->executable->setMemoryLimit($memory_limit ?: $this->memoryLimit); $this->executable->setMemoryUsage($memory_usage_first ?: $this->memoryLimit, $memory_usage_second ?: $this->memoryLimit); $this->executable->setMemoryThreshold(0.85); if ($message) { $this->executable->message->expects($this->at(0))->method('display')->with($this->stringContains('reclaiming memory')); $this->executable->message->expects($this->at(1))->method('display')->with($this->stringContains($message)); } else { $this->executable->message->expects($this->never())->method($this->anything()); } $result = $this->executable->memoryExceeded(); $this->assertEquals($memory_exceeded, $result); }
/** * Tests the processRow method with an empty pipeline. */ public function testProcessRowEmptyPipeline() { $this->migration->expects($this->once())->method('getProcessPlugins')->with(NULL)->will($this->returnValue(array('test' => array()))); $row = new Row(array(), array()); $this->executable->processRow($row); $this->assertSame($row->getDestination(), array()); }