public function testIndex() { $response = $this->controller->index(); $this->assertIsA($response, 'ActionResponse'); $nodes = $response->get('nodes'); // +1 for offline methods $this->assertEqual(count($nodes), count(EavField::getEavClasses()) + 1); }
public function index() { $nodes = array(); foreach (EavField::getEavClasses() as $class => $id) { $nodes[] = array('ID' => $id, 'name' => $this->translate($class)); } // get offline payment methods $offlineMethods = array(); foreach (OfflineTransactionHandler::getEnabledMethods() as $method) { $id = substr($method, -1); $offlineMethods[] = array('ID' => $method, 'name' => $this->config->get('OFFLINE_NAME_' . $id)); } if ($offlineMethods) { $nodes[] = array('ID' => 'offline methods', 'name' => $this->translate('_offline_methods'), 'sub' => $offlineMethods); } return new ActionResponse('nodes', $nodes); }