7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
16
* @package Zend_Version
17
* @subpackage UnitTests
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
20
* @version $Id: VersionTest.php 11973 2008-10-15 16:00:56Z matthew $
26
require_once dirname(__FILE__) . '/../TestHelper.php';
31
require_once 'Zend/Version.php';
35
* @package Zend_Version
36
* @subpackage UnitTests
37
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
38
* @license http://framework.zend.com/license/new-bsd New BSD License
40
class Zend_VersionTest extends PHPUnit_Framework_TestCase
43
* Tests that version_compare() and its "proxy"
44
* Zend_Version::compareVersion() work as expected.
46
public function testVersionCompare()
49
// unit test breaks if ZF version > 1.x
50
for ($i=0; $i <= 1; $i++) {
51
for ($j=0; $j < 10; $j++) {
52
for ($k=0; $k < 20; $k++) {
53
foreach (array('PR', 'dev', 'alpha', 'beta', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl') as $rel) {
54
$ver = "$i.$j.$k$rel";
55
if ($ver === Zend_Version::VERSION
56
|| "$i.$j.$k-$rel" === Zend_Version::VERSION
57
|| "$i.$j.$k.$rel" === Zend_Version::VERSION
58
|| "$i.$j.$k $rel" === Zend_Version::VERSION) {
61
$this->fail("Unexpected double match for Zend_Version::VERSION ("
62
. Zend_Version::VERSION . ")");
68
$this->assertSame(Zend_Version::compareVersion($ver), $expect,
69
"For version '$ver' and Zend_Version::VERSION = '"
70
. Zend_Version::VERSION . "': result=" . (Zend_Version::compareVersion($ver))
71
. ', but expected ' . $expect);
78
$this->fail('Unable to recognize Zend_Version::VERSION ('. Zend_Version::VERSION . ')');