<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/*
* @package Runemaster
* @copyright 2008 KUMAKURA Yousuke All rights reserved.
* @version SVN: $Id: MixSpec.php 42 2008-08-20 15:33:33Z kumatch $
* @since File available since Release 0.1.0
*/
require_once dirname(__FILE__) . '/prepare.php';
// {{{ Describeæ©è½ã®è¤åå©ç¨
/**
* æ©è½ã®è¤åå©ç¨ã«é¢ããSpec
*
* @package Runemaster
* @copyright 2008 KUMAKURA Yousuke All rights reserved.
* @version Release: @package_version@
* @since Class available since Release 0.1.0
*/
class Describeæ©è½ã®è¤åå©ç¨ extends SpecCommon
{
// {{{ properties
/**#@+
* @access public
*/
/**#@-*/
/**#@+
* @access protected
*/
/**#@-*/
/**#@+
* @access private
*/
/**#@-*/
/**#@+
* @access public
*/
public function itforeachæ§æã¨ifæ§æãçµã¿åããã¦å©ç¨ã§ãã()
{
$variables = new stdClass();
$variables->items1 = array('foo', 'bar', null, 'baz');
$variables->items2 = array('foo', 'bar', null, 'baz');
$variables->persons = array('bob', 'mike');
$master = $this->_master;
$master->assign($variables);
$display = rendererInTest($master, 'Mix/IfForeach');
$result = file_get_contents('./results/Mix/IfForeach.html');
$this->spec($display)->should->be($result);
}
public function itforeachæ§æã§ç¹°ãè¿ãããã³ã³ãã³ãå
ã®ã¨ã¬ã¡ã³ãè¦ç´ ãï½ï½å¤æ°ã§å¤æ´ã§ãã()
{
$variables = new stdClass();
$variables->entries = array(array('value' => 'foo', 'color' => '#000000'),
array('value' => 'bar', 'color' => '#FFFFFF'),
);
$master = $this->_master;
$master->assign($variables);
$display = rendererInTest($master, 'Mix/ForeachSetAttribute');
$result = file_get_contents('./results/Mix/ForeachSetAttribute.html');
$this->spec($display)->should->be($result);
}
public function itforeachæ§æã§ç¹°ãè¿ãããã³ã³ãã³ãå
ã§ãã§ãã¯ããã¯ã¹ã®çæããã³ãã§ãã¯ç¶æ
ãå®ç¾ã§ãã()
{
$variables = new stdClass();
$variables->checkboxes = array(array('value' => 1, 'name' => 'foo'),
array('value' => 2, 'name' => 'bar'),
);
$formValue = new stdClass();
$formValue->checkbox = array(2);
$master = $this->_master;
$master->assign($variables);
$master->setFormValue(null, $formValue);
$display = rendererInTest($master, 'Mix/ForeachCheckbox');
$result = file_get_contents('./results/Mix/ForeachCheckbox.html');
$this->spec($display)->should->be($result);
}
public function itappendããã³ã³ãã³ãå
ã«è¨è¼ããã¦ãããã³ãã¬ã¼ã夿°ãç½®æã§ãã()
{
$node = '<span key="foo"></span>';
$master = $this->_master;
$master->append('#foo', $node);
$master->assign(array('foo' => 'Foo'));
$display = rendererInTest($master, 'Mix/AssignAfterAppend');
$result = file_get_contents('./results/Mix/AssignAfterAppend.html');
$this->spec($display)->should->be($result);
}
public function itsetattributesã§ãã³ãã¬ã¼ã夿°å±æ§ã追å ããã¿ã°ã®å¤æ°ãç½®æã§ãã()
{
$element = new stdClass();
$element->key = 'foo';
$master = $this->_master;
$master->setAttribute('#foo', $element);
$master->assign(array('foo' => 'Foo'));
$display = rendererInTest($master, 'Mix/AssignAfterSetAttributes');
$result = file_get_contents('./results/Mix/AssignAfterSetAttributes.html');
$this->spec($display)->should->be($result);
}
/**#@-*/
/**#@+
* @access protected
*/
/**#@-*/
/**#@+
* @access private
*/
/**#@-*/
// }}}
}
// }}}
/*
* Local Variables:
* mode: php
* coding: utf-8
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* indent-tabs-mode: nil
* End:
*/
?>