mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Shortening notation in Session test, removing debug data from HtmlHelper test
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4621 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
de7423e4b6
commit
fb7c56024c
2 changed files with 23 additions and 31 deletions
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: $ */
|
/* SVN FILE: $Id$ */
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Short description for file.
|
||||||
*
|
*
|
||||||
|
@ -21,9 +21,9 @@
|
||||||
* @package test_suite
|
* @package test_suite
|
||||||
* @subpackage test_suite.cases.app
|
* @subpackage test_suite.cases.app
|
||||||
* @since CakePHP Test Suite v 1.0.0.0
|
* @since CakePHP Test Suite v 1.0.0.0
|
||||||
* @version $Revision: $
|
* @version $Revision$
|
||||||
* @modifiedby $LastChangedBy: $
|
* @modifiedby $LastChangedBy$
|
||||||
* @lastmodified $Date: $
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
*/
|
*/
|
||||||
require_once LIBS.'session.php';
|
require_once LIBS.'session.php';
|
||||||
|
@ -42,47 +42,38 @@ class SessionTest extends UnitTestCase {
|
||||||
|
|
||||||
function testCheck() {
|
function testCheck() {
|
||||||
$this->Session->write('SessionTestCase', 'value');
|
$this->Session->write('SessionTestCase', 'value');
|
||||||
$result = $this->Session->check('SessionTestCase');
|
$this->assertTrue($this->Session->check('SessionTestCase'));
|
||||||
$this->assertEqual($result, true);
|
|
||||||
|
$this->assertFalse($this->Session->check('NotExistingSessionTestCase'), false);
|
||||||
$result = $this->Session->check('NotExistingSessionTestCase');
|
|
||||||
$this->assertEqual($result, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCheckingSavedEmpty() {
|
function testCheckingSavedEmpty() {
|
||||||
$this->Session->write('SessionTestCase', 0);
|
$this->Session->write('SessionTestCase', 0);
|
||||||
$result = $this->Session->check('SessionTestCase');
|
$this->assertTrue($this->Session->check('SessionTestCase'));
|
||||||
$this->assertEqual($result, true);
|
|
||||||
|
|
||||||
$this->Session->write('SessionTestCase', '0');
|
$this->Session->write('SessionTestCase', '0');
|
||||||
$result = $this->Session->check('SessionTestCase');
|
$this->assertTrue($this->Session->check('SessionTestCase'));
|
||||||
$this->assertEqual($result, true);
|
|
||||||
|
|
||||||
$this->Session->write('SessionTestCase', false);
|
$this->Session->write('SessionTestCase', false);
|
||||||
$result = $this->Session->check('SessionTestCase');
|
$this->assertTrue($this->Session->check('SessionTestCase'));
|
||||||
$this->assertEqual($result, true);
|
|
||||||
|
|
||||||
$this->Session->write('SessionTestCase', null);
|
$this->Session->write('SessionTestCase', null);
|
||||||
$result = $this->Session->check('SessionTestCase');
|
$this->assertFalse($this->Session->check('SessionTestCase'));
|
||||||
$this->assertEqual($result, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testReadingSavedEmpty() {
|
function testReadingSavedEmpty() {
|
||||||
$this->Session->write('SessionTestCase', 0);
|
$this->Session->write('SessionTestCase', 0);
|
||||||
$result = $this->Session->read('SessionTestCase');
|
$this->assertEqual($this->Session->read('SessionTestCase'), 0);
|
||||||
$this->assertEqual($result, 0);
|
|
||||||
|
|
||||||
$this->Session->write('SessionTestCase', '0');
|
$this->Session->write('SessionTestCase', '0');
|
||||||
$result = $this->Session->read('SessionTestCase');
|
$this->assertEqual($this->Session->read('SessionTestCase'), '0');
|
||||||
$this->assertEqual($result, '0');
|
$this->assertFalse($this->Session->read('SessionTestCase') === 0);
|
||||||
|
|
||||||
$this->Session->write('SessionTestCase', false);
|
$this->Session->write('SessionTestCase', false);
|
||||||
$result = $this->Session->read('SessionTestCase');
|
$this->assertFalse($this->Session->read('SessionTestCase'));
|
||||||
$this->assertEqual($result, false);
|
|
||||||
|
|
||||||
$this->Session->write('SessionTestCase', null);
|
$this->Session->write('SessionTestCase', null);
|
||||||
$result = $this->Session->read('SessionTestCase');
|
$this->assertEqual($this->Session->read('SessionTestCase'), null);
|
||||||
$this->assertEqual($result, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
|
|
|
@ -42,29 +42,30 @@ class HtmlHelperTest extends UnitTestCase {
|
||||||
var $html = null;
|
var $html = null;
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
$this->html = new HtmlHelper();
|
$this->Html = new HtmlHelper();
|
||||||
$view = new View(new TheHtmlTestController());
|
$view = new View(new TheHtmlTestController());
|
||||||
ClassRegistry::addObject('view', $view);
|
ClassRegistry::addObject('view', $view);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSelectTag() {
|
function testSelectTag() {
|
||||||
@$result = $this->html->selectTag('Model/field', array());
|
@$result = $this->Html->selectTag('Model/field', array());
|
||||||
$this->assertPattern('/^<select [^<>]+>\n<option [^<>]+>/', $result);
|
$this->assertPattern('/^<select [^<>]+>\n<option [^<>]+>/', $result);
|
||||||
$this->assertPattern('/<option value="" ><\/option>/', $result);
|
$this->assertPattern('/<option value="" ><\/option>/', $result);
|
||||||
$this->assertPattern('/<\/select>$/', $result);
|
$this->assertPattern('/<\/select>$/', $result);
|
||||||
$this->assertPattern('/<select[^<>]+name="data\[Model\]\[field\]"[^<>]*>/', $result);
|
$this->assertPattern('/<select[^<>]+name="data\[Model\]\[field\]"[^<>]*>/', $result);
|
||||||
$this->assertPattern('/<select[^<>]+id="ModelField"[^<>]*>/', $result);
|
$this->assertPattern('/<select[^<>]+id="ModelField"[^<>]*>/', $result);
|
||||||
|
|
||||||
$this->html->data = array('Model' => array('field' => 'value'));
|
$this->Html->data = array('Model' => array('field' => 'value'));
|
||||||
@$result = $this->html->selectTag('Model/field', array('value' => 'good', 'other' => 'bad'));
|
@$result = $this->Html->selectTag('Model/field', array('value' => 'good', 'other' => 'bad'));
|
||||||
$this->assertPattern('/option value=""/', $result);
|
$this->assertPattern('/option value=""/', $result);
|
||||||
$this->assertPattern('/option value="value"/', $result);
|
$this->assertPattern('/option value="value"/', $result);
|
||||||
$this->assertPattern('/option value="other"/', $result);
|
$this->assertPattern('/option value="other"/', $result);
|
||||||
debug($result, true);
|
$this->assertPattern('/<\/option>\s+<option/', $result);
|
||||||
|
$this->assertPattern('/<\/option>\s+<\/select>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
unset($this->html);
|
unset($this->Html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue