/** * @return void */ public function setUp() { $iniReader = new Ini(); $config = new Config($iniReader->fromFile('../../../local/config/vufind/config.ini')); $this->url = $config->get('Index')->get('url') . '/' . $config->get('Index')->get('default_core'); $this->urlAdmin = $config->get('Index')->get('url') . '/admin'; }
/** * Fetch the entire translation.ini, or a part * @return Config|string */ private function getConfig($section = null, $setting = null) { $config = $this->getServiceLocator()->get('config'); $config = $config['circlical']['translation_editor']; $cache_dir = $config['cache_dir']; $translator_config = $cache_dir . '/translator.ini'; $params = []; if (file_exists($translator_config)) { $reader = new ConfigReader(); $params = $reader->fromFile($translator_config); } $config = new Config($params, true); if ($section) { if (isset($config->{$section})) { if ($setting) { return isset($config->{$section}->{$setting}) ? $config->{$section}->{$setting} : null; } else { return $config->{$section}; } } else { return null; } } return $config; }
public function createService(ServiceLocatorInterface $serviceLocator) { $manager = new ThemeManager(); $iniReader = new IniReader(); $connection = $serviceLocator->get('Omeka\\Connection'); // Get all themes from the filesystem. foreach (new DirectoryIterator(OMEKA_PATH . '/themes') as $dir) { // Theme must be a directory if (!$dir->isDir() || $dir->isDot()) { continue; } // Theme directory must contain config/module.ini $iniFile = new SplFileInfo($dir->getPathname() . '/config/theme.ini'); if (!$iniFile->isReadable() || !$iniFile->isFile()) { continue; } // Theme INI must be valid $ini = $iniReader->fromFile($iniFile->getRealPath()); if (!$manager->iniIsValid($ini)) { continue; } $manager->registerTheme(new Theme($dir->getBasename(), $ini)); } return $manager; }
public function onBootstrap(MvcEvent $e) { $app = $e->getParam("application"); //Este fragmento de código se usa cuando hay instalador $reader = new Ini(); $data = $reader->fromFile(__DIR__ . '/config/config.ini'); $appInstalada = false; if ($data['production']['configuracion']['instalado'] == "0") { $app->getEventManager()->attach('dispatch', array($this, 'initInstalacion'), 20000); $config = new Config(array(), true); $config->production = array(); $config->production->configuracion = array(); $config->production->configuracion->instalado = "-1"; $config->production->configuracion->confirmado = "0"; $writer = new Ini2(); $writer->toFile(__DIR__ . '/config/config.ini', $config); } elseif ($data['production']['configuracion']['instalado'] == "-1") { return; } else { $appInstalada = true; } if ($appInstalada) { $app->getEventManager()->attach('dispatch', array($this, 'initAuth'), 200); } $moduleRouteListener = new ModuleRouteListener(); $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener->attach($eventManager); }
/** * load(): defined by FileLoaderInterface. * * @see FileLoaderInterface::load() * @param string $locale * @param string $filename * @return TextDomain|null * @throws Exception\InvalidArgumentException */ public function load($locale, $filename) { $resolvedIncludePath = stream_resolve_include_path($filename); $fromIncludePath = $resolvedIncludePath !== false ? $resolvedIncludePath : $filename; if (!$fromIncludePath || !is_file($fromIncludePath) || !is_readable($fromIncludePath)) { throw new Exception\InvalidArgumentException(sprintf('Could not find or open file %s for reading', $filename)); } $messages = []; $iniReader = new IniReader(); $messagesNamespaced = $iniReader->fromFile($fromIncludePath); $list = $messagesNamespaced; if (isset($messagesNamespaced['translation'])) { $list = $messagesNamespaced['translation']; } foreach ($list as $message) { if (!is_array($message) || count($message) < 2) { throw new Exception\InvalidArgumentException('Each INI row must be an array with message and translation'); } if (isset($message['message']) && isset($message['translation'])) { $messages[$message['message']] = $message['translation']; continue; } $messages[array_shift($message)] = array_shift($message); } if (!is_array($messages)) { throw new Exception\InvalidArgumentException(sprintf('Expected an array, but received %s', gettype($messages))); } $textDomain = new TextDomain($messages); if (array_key_exists('plural', $messagesNamespaced) && isset($messagesNamespaced['plural']['plural_forms'])) { $textDomain->setPluralRule(PluralRule::fromString($messagesNamespaced['plural']['plural_forms'])); } return $textDomain; }
public function __construct(Adapter $adapter) { $this->adapter = $adapter; $reader = new Ini(); $this->config = $reader->fromFile('config/autoload/config.ini'); $this->environment = $this->config['environment']; $this->config = $this->config[$this->environment]; }
/** * (non-PHPdoc) * * @see \Zend\ModuleManager\Feature\ConfigProviderInterface::getConfig() */ public function getConfig() { $currentConfig = (include __DIR__ . '/config/zendservernagiosplugin.config.php'); $additionalConfigFile = new Ini(); $additionalConfig = $additionalConfigFile->fromFile(__DIR__ . '/../../config/config.ini'); $currentConfig = array_merge($currentConfig, $additionalConfig); return $currentConfig; }
/** * (non-PHPdoc) * * @see \Zend\Stdlib\Hydrator\Strategy\StrategyInterface::hydrate() */ public function hydrate($value) { if ('' != $value['params']) { $config = new IniReader(); $value['params'] = $config->fromString($value['params']); } return $value; }
/** * Create service * * @param ServiceLocatorInterface $serviceLocator * @return mixed */ public function createService(ServiceLocatorInterface $serviceLocator) { //$config = Factory::fromFile( '/usr/local/vufind/resources.swissbib.ch/local/config/resources/config.ini'); $config1 = new Ini(); APP_BASE; $test = $config1->fromFile(APPLICATION_PATH . '/local/config/resources/config.ini'); $t = new ZendConfig($test); return $t; }
protected function initConfig(MvcEvent $e) { $application = $e->getApplication(); $services = $application->getServiceManager(); $services->setFactory('ConfigPosterlabs', function ($services) { $reader = new Ini(); $data = $reader->fromFile(__DIR__ . '/config/config.ini'); return $data; }); }
/** * Checks if the provided value can be read by Zend\Config\Ini. * * @param string $value * @return boolean */ protected function parseIni($value) { $iniReader = new Ini(); try { $ini = $iniReader->fromString($value); return true; } catch (\Exception $e) { return false; } }
public function loadTranslations() { $DS = DIRECTORY_SEPARATOR; $confPath = ROOT . $DS . 'conf' . $DS . 'lang' . $DS; foreach (glob($confPath . '*.ini') as $file) { $fileName = pathinfo($file, PATHINFO_FILENAME); $reader = new Ini(); $this->dictionary[$fileName] = new Config($reader->fromFile($file)); } }
public static function transformDate($date) { $reader = new Ini(); $config = $reader->fromFile('config/autoload/config.ini'); $sqlsrvlang = $config['sqlsrvlang']; if ($sqlsrvlang == 'es') { $dates = explode('-', $date); $date = $dates[2] . '-' . $dates[1] . '-' . $dates[0]; } return $date; }
public static function setupConfig(Container $container) { $container->add('config', function () { $DS = DIRECTORY_SEPARATOR; $confPath = ROOT . $DS . 'conf' . $DS; $reader = new Ini(); $config = new Config($reader->fromFile($confPath . 'default.ini')); if (file_exists($confPath . 'local.ini')) { $config->merge(new Config($reader->fromFile($confPath . 'local.ini'))); } return $config; }, true); }
/** * * @param string $name * @param string $routename * @return boolean */ public function checkAutorisation($name, $routename) { $this->initAcl(); $config = $this->getServiceLocator()->get('Config'); $filePath = $config['auth']['filePath']; $reader = new Ini(); try { $usersData = $reader->fromFile($filePath); } catch (\Exception $e) { error_log($e->getMessage()); return false; } return is_array($usersData) && array_key_exists($name, $usersData) && $this->acl->hasResource($routename) && $this->acl->hasRole($usersData[$name]) && $this->acl->isAllowed($usersData[$name], $routename); }
/** * Load the specified configuration file. * * @param string $filename config file name * @param string $path path relative to VuFind base (optional; defaults * to config/vufind * * @return Config */ protected function loadConfigFile($filename, $path = 'config/vufind') { $configs = []; $fullpath = Locator::getConfigPath($filename, $path); // Return empty configuration if file does not exist: if (!file_exists($fullpath)) { return new Config([]); } // Retrieve and parse at least one configuration file, and possibly a whole // chain of them if the Parent_Config setting is used: do { $configs[] = new Config($this->iniReader->fromFile($fullpath), true); $i = count($configs) - 1; if (isset($configs[$i]->Parent_Config->path)) { $fullpath = $configs[$i]->Parent_Config->path; } elseif (isset($configs[$i]->Parent_Config->relative_path)) { $fullpath = pathinfo($fullpath, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . $configs[$i]->Parent_Config->relative_path; } else { $fullpath = false; } } while ($fullpath); // The last element in the array will be the top of the inheritance tree. // Let's establish a baseline: $config = array_pop($configs); // Now we'll pull all the children down one at a time and override settings // as appropriate: while (!is_null($child = array_pop($configs))) { $overrideSections = isset($child->Parent_Config->override_full_sections) ? explode(',', str_replace(' ', '', $child->Parent_Config->override_full_sections)) : []; foreach ($child as $section => $contents) { // Omit Parent_Config from the returned configuration; it is only // needed during loading, and its presence will cause problems in // config files that iterate through all of the sections (e.g. // combined.ini, permissions.ini). if ($section === 'Parent_Config') { continue; } if (in_array($section, $overrideSections) || !isset($config->{$section})) { $config->{$section} = $child->{$section}; } else { foreach (array_keys($contents->toArray()) as $key) { $config->{$section}->{$key} = $child->{$section}->{$key}; } } } } $config->setReadOnly(); return $config; }
public function onAdministratorPreDispatch(MvcEvent $e) { /** * @access Initialize the Paramters * @return array */ $cacheFileSystem = $e->getApplication()->getServiceManager()->get('Zend\\Cache\\Storage\\Adapter\\Filesystem'); if ($cacheFileSystem == false) { $e->getApplication()->getServiceManager()->get('ControllerPluginManager')->get('CoreCPlugin')->setLog('Administrator|Module', 'onAdministratorPreDispatch', 'Fatal Error :: Administrator|Module Line 51 - Cache Adapter FileSystem Callback False'); exit('Fatal Error : Administrator|Module'); } $cacheFileSystem->getOptions()->setNamespace(__NAMESPACE__); $cacheFileSystem->getOptions()->setTtl(864000); if (!$cacheFileSystem->hasItem('StaticParameters')) { $ini = new Ini(); $iniParameters = $ini->setNestSeparator('::')->fromFile(__DIR__ . '/config/p.ini'); $cacheFileSystem->setItem('StaticParameters', serialize($iniParameters)); } }
/** * @param int $id * @return int * @throws UthandoException */ public function sendMessage($id) { $message = $this->getById($id); if ($message->isSent()) { throw new UthandoException('Cannot send message out again.'); } // we need to set the server url before add to mail queue $serverUrlHelper = $this->getService('ViewHelperManager')->get('ServerUrl'); $basePathUrlHelper = $this->getService('ViewHelperManager')->get('BasePath'); $serverUrl = $serverUrlHelper() . $basePathUrlHelper(); $iniReader = new IniReader(); $iniWriter = new IniWriter(); $params = $iniReader->fromString($message->getParams()); $params['server_url'] = $serverUrl; $message->setParams($iniWriter->toString($params)); $viewModel = new NewsletterModel(); $viewModel->setTemplate('message/' . $message->getMessageId()); /* @var $subscriptionMapper SubscriptionMapper */ $subscriptionMapper = $this->getService('UthandoNewsletterSubscription')->getMapper(); $subscriptions = $subscriptionMapper->getSubscriptionsByNewsletterId($message->getNewsletterId()); $subscriberIds = []; /* @var $subscription SubscriptionModel */ foreach ($subscriptions as $subscription) { $subscriberIds[] = $subscription->getSubscriberId(); } /* @var $subscriberMapper SubscriberMapper */ $subscriberMapper = $this->getService('UthandoNewsletterSubscriber')->getMapper(); $subscribers = $subscriberMapper->getSubscribersById($subscriberIds); $count = 0; /* @var $subscriber SubscriberModel */ foreach ($subscribers as $subscriber) { $this->getEventManager()->trigger('mail.queue', $this, ['recipient' => ['name' => $subscriber->getName(), 'address' => $subscriber->getEmail()], 'layout' => $viewModel, 'body' => null, 'subject' => $message->getSubject(), 'renderer' => 'ViewNewsletterRenderer', 'transport' => 'default']); $count++; } // set message as sent and save to database. $message->setDateSent(null)->setSent(true); $this->save($message); return $count; }
/** * @param null $menu * @param bool|true $multiArray * @return Navigation */ public function getPages($menu = null, $multiArray = true) { /* @var $service \UthandoNavigation\Service\MenuItem */ $service = $this->getService('UthandoNavigationMenuItem'); $config = new Ini(); if (null === $menu) { $pages = $service->fetchAll(); } else { $pages = $service->getMenuItemsByMenu($menu); } $pageArray = []; /* @var $page \UthandoNavigation\Model\MenuItem */ foreach ($pages as $page) { $p = $page->getArrayCopy(); $params = $config->fromString($p['params']); // need to initialise params array else error occurs $p['params'] = []; // params contain route params and other element params like: // id, class etc. foreach ($params as $key => $value) { $p[$key] = $value; } if ($p['route'] == '0') { unset($p['route']); $p['uri'] = '#'; } else { unset($p['uri']); } if ($p['resource'] == null) { unset($p['resource']); } $pageArray[] = $p; } if ($multiArray) { $pageArray = ArrayUtils::listToMultiArray($pageArray); } return new Navigation($this->preparePages($pageArray)); }
/** * Manage special input parameters (arrays and files) and target * * @param MvcEvent $event */ public function postRoute(MvcEvent $event) { $match = $event->getRouteMatch(); if (!$match) { return; } $services = $event->getApplication()->getServiceManager(); // [Normalize the arguments] $config = $services->get('config'); $routeName = $match->getMatchedRouteName(); if (isset($config['console']['router']['routes'][$routeName]['options']['arrays'])) { foreach ($config['console']['router']['routes'][$routeName]['options']['arrays'] as $arrayParam) { if ($value = $match->getParam($arrayParam)) { $data = array(); // if the data ends with <char(s)> then we have special delimiter $delimiter = '&'; // Ex: "x[1]=2&y[b]=z" if (strpos($value, '=') === false) { // when we do not have pairs the delimiter in such situations // is set to "comma" by default $delimiter = ','; // Ex: "x,y,z" } if (preg_match("/<(.*?)>\$/", $value, $m)) { // Ex: "x[1]=2|y[b]=z<|>" - the delimiter is | and the pairs are x[1]=2 and y[b]=z $delimiter = $m[1]; $value = substr($value, 0, strlen($value) - strlen("<{$delimiter}>")); } if (strpos($value, '=') === false) { // we do not have pairs $data = explode($delimiter, $value); foreach ($data as $i => $v) { $data[$i] = trim($v); } } else { // Ex: x=1 y[1]=2 y[2]=3 Utils::parseString($value, $data, $delimiter); } $match->setParam($arrayParam, $data); } } } // [Translate all paths to real absolute paths] if (isset($config['console']['router']['routes'][$routeName]['options']['files'])) { $path = $services->get('path'); foreach ($config['console']['router']['routes'][$routeName]['options']['files'] as $param) { if ($value = $match->getParam($param)) { if (!is_array($value)) { $match->setParam($param, $path->getAbsolute($value)); } else { $newValue = array_map(function ($v) use($path) { return $path->getAbsolute($v); }, $value); $match->setParam($param, $newValue); } } } } // [Figure out the target] if (isset($config['console']['router']['routes'][$routeName]['options']['no-target'])) { return; } // Read the default target $targetConfig = $services->get('targetConfig'); // Add manage named target (defined in zsapi.ini) $target = $match->getParam('target'); if ($target) { try { $reader = new ConfigReader(); $data = $reader->fromFile($config['zsapi']['file']); if (empty($data[$target])) { if (!isset($config['console']['router']['routes'][$routeName]['options']['ingore-target-load'])) { throw new \Zend\Console\Exception\RuntimeException('Invalid target specified.'); } else { $data[$target] = array(); } } foreach ($data[$target] as $k => $v) { $targetConfig[$k] = $v; } } catch (\Zend\Config\Exception\RuntimeException $ex) { if (!isset($config['console']['router']['routes'][$routeName]['options']['ingore-target-load'])) { throw new \Zend\Console\Exception\RuntimeException('Make sure that you have set your target first. \\n This can be done with ' . __FILE__ . ' addTarget --target=<UniqueName> --zsurl=http://localhost:10081/ZendServer --zskey= --zssecret='); } } } if (empty($targetConfig) && !($match->getParam('zskey') || $match->getParam('zssecret') || $match->getParam('zsurl'))) { throw new \Zend\Console\Exception\RuntimeException('Specify either a --target= parameter or --zsurl=http://localhost:10081/ZendServer --zskey= --zssecret='); } // optional: override the target parameters from the command line foreach (array('zsurl', 'zskey', 'zssecret', 'zsversion', 'http') as $key) { if (!$match->getParam($key)) { continue; } $targetConfig[$key] = $match->getParam($key); } $outputFormat = $match->getParam('output-format', 'xml'); if ($outputFormat == 'kv') { $outputFormat = "json"; } $apiManager = $services->get('zend_server_api'); $apiManager->setOutputFormat($outputFormat); }
/** * This method is responsible for returning a configIni object wrapping * which ever ini file is passed in. * @param $fileSrcPath string The path to the ini file. * @return Zend\Config\Config */ private function _getConfigIniFromIniPath($fileSrcPath) { $reader = new Ini(); $config = $reader->fromFile($fileSrcPath); return new Config($config); }
/** * @param string $data * @param string $format * @param array $context * * @return mixed */ public function decode($data, $format, array $context = array()) { return $this->decoder->fromString($data); }
/** * Reads all targets * @return array associative array with all targets. * - key - name of the the target * - value - target properties * @throws ConfigException */ public function load() { $reader = new ConfigReader(); return $reader->fromFile($this->configFile); }
/** * Create the module manager * * @param ServiceLocatorInterface $serviceLocator * @return array */ public function createService(ServiceLocatorInterface $serviceLocator) { $manager = new ModuleManager(); $iniReader = new IniReader(); $connection = $serviceLocator->get('Omeka\\Connection'); // Get all modules from the filesystem. foreach (new DirectoryIterator(OMEKA_PATH . '/modules') as $dir) { // Module must be a directory if (!$dir->isDir() || $dir->isDot()) { continue; } $module = $manager->registerModule($dir->getBasename()); // Module directory must contain config/module.ini $iniFile = new SplFileInfo($dir->getPathname() . '/config/module.ini'); if (!$iniFile->isReadable() || !$iniFile->isFile()) { $module->setState(ModuleManager::STATE_INVALID_INI); continue; } $module->setIni($iniReader->fromFile($iniFile->getRealPath())); // Module INI must be valid if (!$manager->iniIsValid($module)) { $module->setState(ModuleManager::STATE_INVALID_INI); continue; } // Module directory must contain Module.php $moduleFile = new SplFileInfo($dir->getPathname() . '/Module.php'); if (!$moduleFile->isReadable() || !$moduleFile->isFile()) { $module->setState(ModuleManager::STATE_INVALID_MODULE); continue; } // Module class must extend Omeka\Module\AbstractModule require_once $moduleFile->getRealPath(); $moduleClass = $dir->getBasename() . '\\Module'; if (!class_exists($moduleClass) || !is_subclass_of($moduleClass, 'Omeka\\Module\\AbstractModule')) { $module->setState(ModuleManager::STATE_INVALID_MODULE); continue; } } // Get all modules from the database, if installed. $dbModules = []; if ($serviceLocator->get('Omeka\\Status')->isInstalled()) { $statement = $connection->prepare("SELECT * FROM module"); $statement->execute(); $dbModules = $statement->fetchAll(); } foreach ($dbModules as $moduleRow) { if (!$manager->isRegistered($moduleRow['id'])) { // Module installed but not in filesystem $module = $manager->registerModule($moduleRow['id']); $module->setDb($moduleRow); $module->setState(ModuleManager::STATE_NOT_FOUND); continue; } $module = $manager->getModule($moduleRow['id']); $module->setDb($moduleRow); if ($module->getState()) { // Module already has state. continue; } $moduleIni = $module->getIni(); if (Comparator::greaterThan($moduleIni['version'], $moduleRow['version'])) { // Module in filesystem is newer version than the installed one. $module->setState(ModuleManager::STATE_NEEDS_UPGRADE); continue; } if ($moduleRow['is_active']) { // Module valid, installed, and active $module->setState(ModuleManager::STATE_ACTIVE); } else { // Module valid, installed, and not active $module->setState(ModuleManager::STATE_NOT_ACTIVE); } } foreach ($manager->getModules() as $id => $module) { if (!$module->getState()) { // Module in filesystem but not installed $module->setState(ModuleManager::STATE_NOT_INSTALLED); } } return $manager; }
/** * @param Template|Message $model * @return string */ public function parseParams($model) { $iniReader = new Ini(); $params = $iniReader->fromString($model->getParams()); if ($model instanceof Message) { $params = array_merge(parse_ini_string($model->getTemplate()->getParams()), $params); } $this->setVariables($params); }
/** * call and read specified configuration * * @param string $path * @param string $type * @return array */ protected function configurationStrategy($path, $type) { $config = []; if (!file_exists($path)) { throw new \InvalidArgumentException('File ' . $path . 'don\'t exists.'); } switch ($type) { case 'array': $config = (include_once $path); break; case 'ini': $reader = new Reader\Ini(); $config = $reader->fromFile($path); break; case 'xml': $reader = new Reader\Xml(); $config = $reader->fromFile($path); break; case 'json': $reader = new Reader\Json(); $config = $reader->fromFile($path); break; case 'yaml': $reader = new Reader\Yaml(['Spyc', 'YAMLLoadString']); $config = $reader->fromFile($path); break; } return $config; }
/** * Support method for init() -- load all of the theme details from either the * session or disk (as needed). * * @param string $currentTheme The name of the user-selected theme. * * @return string Error message on problem, empty string on success. */ protected function loadThemeDetails($currentTheme) { // Fill in the session if it is not already populated: if (!isset($this->session->currentTheme) || $this->session->currentTheme !== $currentTheme) { // If the configured theme setting is illegal, switch it to "blueprint" // and set a flag so we can throw an Exception once everything is set // up: if (!file_exists($this->baseDir . "/{$currentTheme}/theme.ini")) { $themeLoadError = 'Cannot load theme: ' . $currentTheme; $currentTheme = 'blueprint'; } // Remember the top-level theme setting: $this->session->currentTheme = $currentTheme; // Build an array of theme information by inheriting up the theme tree: $allThemeInfo = array(); do { $iniReader = new IniReader(); $currentThemeInfo = new Config($iniReader->fromFile($this->baseDir . "/{$currentTheme}/theme.ini")); $allThemeInfo[$currentTheme] = $currentThemeInfo; $currentTheme = $currentThemeInfo->extends; } while ($currentTheme); $this->session->allThemeInfo = $allThemeInfo; } // Report success or failure: return isset($themeLoadError) ? $themeLoadError : ''; }
/** * @return void */ public function setUp() { $iniReader = new Ini(); $config = new Config($iniReader->fromFile('../../../local/config/vufind/config.ini')); $this->connector = new Connector($config->get('Summon')->get('apiId'), $config->get('Summon')->get('apiKey')); }
/** * Get the Ini Reader. * * @return \Zend\Config\Reader\Ini */ protected static function getIniReader() { static $iniReader = false; // Set up reader if it is not already present in the static variable: if (!$iniReader) { // Use ASCII 0 as a nest separator; otherwise some of the unusual // key names we have (i.e. in WorldCat.ini search options) will get // parsed in unexpected ways. $iniReader = new IniReader(); $iniReader->setNestSeparator(chr(0)); } return $iniReader; }
function testGetCitiesMethod() { $nx = $this->nx; $nx->bootstrap(); $this->assertFalse(file_exists($nx->root_folder . "/dados/consulta/cidades.txt")); $nx->container['request'] = $nx->container->factory(function ($c) { $response = new stdclass(); $response->code = 200; $response->raw_body = '[{"cod_cidade":"35","nome":"Alta Floresta, MT","status":1},{"cod_cidade":"36","nome":"Carlinda, MT","status":"0"},{"cod_cidade":"50","nome":"Cuiab\\u00e1, MT","status":"0"},{"cod_cidade":"37","nome":"Parana\\u00edta, MT","status":"0"},{"cod_cidade":"49","nome":"Sinop, MT","status":"0"}]'; return $response; }); $nx->get_cities(); $this->assertTrue(file_exists($nx->root_folder . "/dados/consulta/cidades.txt")); $reader = new IniReader(); $cities = $reader->fromFile($nx->root_folder . "/dados/consulta/cidades.txt"); $this->assertTrue(isset($cities[0]['cod_cidade'])); $this->assertTrue(isset($cities[0]['nome'])); $this->assertTrue(isset($cities[0]['status'])); }