/** * Tests that version_compare() and its "proxy" * Zend_Version::compareVersion() work as expected. */ public function testVersionCompare() { $expect = -1; for ($i=0; $i < 2; $i++) { for ($j=0; $j < 12; $j++) { for ($k=0; $k < 20; $k++) { foreach (array('dev', 'pr', 'PR', 'alpha', 'a1', 'a2', 'beta', 'b1', 'b2', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl1', 'PL1') as $rel) { $ver = "$i.$j.$k$rel"; $normalizedVersion = strtolower(Version::VERSION); if (strtolower($ver) === $normalizedVersion || strtolower("$i.$j.$k-$rel") === $normalizedVersion || strtolower("$i.$j.$k.$rel") === $normalizedVersion || strtolower("$i.$j.$k $rel") === $normalizedVersion ) { if ($expect == -1) { $expect = 1; } } else { $this->assertSame( Version::compareVersion($ver), $expect, "For version '$ver' and Zend_Version::VERSION = '" . Version::VERSION . "': result=" . (Version::compareVersion($ver)) . ', but expected ' . $expect); } } } } }; }
/** * This is the "about" action. It is used to display the "About" page. * @return \Zend\View\Model\ViewModel */ public function aboutAction() { // Get current ZF version $zendFrameworkVer = Version::VERSION; // Fetch the latest available version of ZF $latestVer = Version::getLatest(); // Test if newer version is available $isNewerVerAvailable = Version::compareVersion($latestVer); // Return variables to view script with the help of // ViewObject variable container return new ViewModel(array('zendFrameworkVer' => $zendFrameworkVer, 'isNewerVerAvailable' => $isNewerVerAvailable, 'latestVer' => $latestVer)); }
public function _after(\Codeception\TestCase $test) { $_SESSION = array(); $_GET = array(); $_POST = array(); $_COOKIE = array(); // reset singleton StaticEventManager::resetInstance(); // Reset singleton placeholder if version < 2.2.0, no longer required in 2.2.0+ if (Version::compareVersion('2.2.0') >= 0) { Placeholder\Registry::unsetRegistry(); } $this->queries = 0; $this->time = 0; }
public function _after(\Codeception\TestCase $test) { $_SESSION = []; $_GET = []; $_POST = []; $_COOKIE = []; // reset singleton StaticEventManager::resetInstance(); // Reset singleton placeholder if version < 2.2.0, no longer required in 2.2.0+ if (Version::compareVersion('2.2.0') >= 0) { Placeholder\Registry::unsetRegistry(); } //Close the session, if any are open if (session_status() == PHP_SESSION_ACTIVE) { session_write_close(); } $this->queries = 0; $this->time = 0; }
$result = TEST_FAIL; $failed = true; } Helper::printLineToc($counter, 'Checking HTTPS stream wrapper', $result); $counter++; // ----------------------------------------------------------------------------- if (true === method_exists('\\Zend\\Debug\\Debug', 'dump')) { $result = TEST_PASS; } else { $result = TEST_FAIL; $failed = true; } Helper::printLineToc($counter, 'Checking Zend Framework path', $result); $counter++; // ----------------------------------------------------------------------------- if (1 === Version::compareVersion(PHP_VERSION, MIN_PHP_VERSION)) { $result = TEST_PASS; } else { $result = TEST_FAIL; $failed = true; } Helper::printLineToc($counter, sprintf('Checking Zend Framework version (%s)', Version::VERSION), $result); $counter++; // ----------------------------------------------------------------------------- if (extension_loaded('openssl')) { $version = OPENSSL_VERSION_TEXT; $result = TEST_PASS; } else { $version = 'N/A'; $result = TEST_FAIL; $failed = true;