public function testToArray() { $name = 'my-name'; $timeTaken = 1700; $memoryUsage = 1100000; $memoryUsed = 11000234; $options = ['my' => 'option']; $arrayData = array('name' => $name, 'timeTaken' => $timeTaken, 'memoryUsage' => $memoryUsage, 'memoryUsed' => $memoryUsed, 'options' => $options, 'createdAt' => $this->sectionData->getCreatedAt()->format('Y-m-d H:i:s')); $this->sectionData->setName($name); $this->sectionData->setTimeTaken($timeTaken); $this->sectionData->setMemoryUsage($memoryUsage); $this->sectionData->setMemoryUsed($memoryUsed); $this->sectionData->setOptions($options); $this->assertSame($arrayData, $this->sectionData->toArray()); }
/** * Sets data by name in data array * * @param string $name * @param double $timeTaken * @param int$memoryUsage * @param int $memoryUsed * @param array $options * @author Daniel Wendlandt */ private function setData($name, $timeTaken, $memoryUsage, $memoryUsed, array $options) { $dataObj = new SectionData(); $dataObj->setName($name); $dataObj->setTimeTaken($timeTaken); $dataObj->setMemoryUsage($memoryUsage); $dataObj->setMemoryUsed($memoryUsed); $dataObj->setOptions($options); $this->data[$name] = $dataObj; }