/** * 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); } } } } }; }
$result = TEST_FAIL; $failed = true; } Helper::printLineToc($counter, 'Checking HTTPS stream wrapper', $result); $counter++; // ----------------------------------------------------------------------------- if (true === method_exists('\\Zend\\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;