cacert-testmgr/external/ZendFramework-1.9.5/tests/Zend/Validate/Sitemap/PriorityTest.php
Markus Warg 8398c9048d initially import ZendFramework-1.9.5 into repository
code was modified slightly, so the code differs from the original downloadable 1.9.5 version
2010-03-31 10:12:32 +02:00

95 lines
2.5 KiB
PHP

<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Translate
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Zend/Validate/Sitemap/Priority.php';
/**
* Tests Zend_Validate_Sitemap_Priority
*
* @category Zend
* @package Zend_Validate
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Validate
*/
class Zend_Validate_Sitemap_PriorityTest extends PHPUnit_Framework_TestCase
{
/**
* Validator
*
* @var Zend_Validate_Sitemap_Priority
*/
protected $_validator;
/**
* Prepares the environment before running a test
*/
protected function setUp()
{
$this->_validator = new Zend_Validate_Sitemap_Priority();
}
/**
* Cleans up the environment after running a test
*/
protected function tearDown()
{
$this->_validator = null;
}
/**
* Tests valid priorities
*
*/
public function testValidPriorities()
{
$values = array(
'0.0', '0.1', '0.2', '0.3', '0.4', '0.5',
'0.6', '0.7', '0.8', '0.9', '1.0', '0.99',
0.1, 0.6667, 0.0001, 0.4, 0, 1, .35
);
foreach ($values as $value) {
$this->assertSame(true, $this->_validator->isValid($value));
}
}
/**
* Tests invalid priorities
*
*/
public function testInvalidPriorities()
{
$values = array(
'alwayz', '_hourly', 'Daily', 'wEekly',
'mönthly ', ' yearly ', 'never ', 'rofl',
'0,0', '1.1', '02', '3', '01.4', '0.f',
1.1, -0.001, 1.0001
);
foreach ($values as $value) {
$this->assertSame(false, $this->_validator->isValid($value));
}
}
}