function testReadWriteFile() { $config = Bootstrap::getServiceManager()->get('config'); $tmpDir = isset($config['potool']['tmp_dir']) ? $config['potool']['tmp_dir'] : '/tmp'; $file = tempnam($tmpDir, 'po_'); $store = new ArrayStore(); $parser = new Parser($store); $parser->readFile(__DIR__ . '/../../../data/Module1/language/ru_RU.po'); $this->assertGreaterThan(0, count($store->read())); // $content1 = file_get_contents(__DIR__ . '/../../../data/Module1/language/ru_RU.po'); $parser->writeFile($file); file_put_contents("/tmp/store.php", var_export($store->read(), true)); $this->assertFileExists($file); $this->assertGreaterThan(0, filesize($file)); // $content2 = file_get_contents($file); unlink($file); // $this->assertSame($content1, $content2); }
function setUp() { $config = Bootstrap::getServiceManager()->get('config'); $this->moduleManager = new ModuleManager($config['potool']); $this->testModulesRoot = __DIR__ . '/../../data'; }
function setUp() { $config = Bootstrap::getServiceManager()->get('config'); $this->moduleManager = new ModuleManager($config['potool']); }
} protected static function initAutoloader() { $vendorPath = static::findParentPath('vendor'); if (is_readable($vendorPath . '/autoload.php')) { $loader = (include $vendorPath . '/autoload.php'); } else { $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false)); if (!$zf2Path) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; } AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__)))); } protected static function findParentPath($path) { $dir = __DIR__; $previousDir = '.'; while (!is_dir($dir . '/' . $path)) { $dir = dirname($dir); if ($previousDir === $dir) { return false; } $previousDir = $dir; } return $dir . '/' . $path; } } Bootstrap::init();