1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214:
<?php
namespace Nethgui\Test\Unit\Nethgui\Renderer;
class XhtmlTest extends \PHPUnit_Framework_TestCase
{
protected $object;
protected function setUp()
{
$view = $this->getMockBuilder('Nethgui\View\View')
->disableOriginalConstructor()
->setMethods(array('getModule'))
->getMock();
$moduleMock = $this->getMockBuilder('Nethgui\Module\ModuleInterface')
->getMock();
$moduleMock->expects($this->any())
->method('getIdentifier')
->will($this->returnValue('ModuleId'));
$moduleMock->expects($this->any())
->method('getParent')
->will($this->returnValue(NULL));
$view->expects($this->any())
->method('getModule')
->will($this->returnValue($moduleMock));
$delegatedCommandReceiver = $this->getMockBuilder('\Nethgui\View\CommandReceiverInterface')
->setMethods(array('executeCommand'))
->getMock();
$this->object = new \Nethgui\Renderer\Xhtml($view, array($this, 'templateResolverCallback'), 0, $delegatedCommandReceiver);
}
public function templateResolverCallback($templateName)
{
throw new \RuntimeException('Not expected to be called');
}
public function testGetDefaultFlags()
{
$this->testSetDefaultFlags();
$this->assertEquals(1, $this->object->getDefaultFlags());
}
public function testSetDefaultFlags()
{
$this->assertSame($this->object, $this->object->setDefaultFlags(1));
}
public function testElementList()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\ElementList', $this->object->elementList());
}
public function testButtonList()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\ElementList', $this->object->elementList());
}
public function testButton()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\Button', $this->object->button('button'));
}
public function testCheckBox()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\CheckBox', $this->object->checkBox('checkbox', 1));
}
public function testFieldsetSwitch()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\FieldsetSwitch', $this->object->fieldsetSwitch('fieldsetSwitch', 'on'));
}
public function testForm()
{
$this->assertInstanceOf('Nethgui\Widget\XhtmlWidget', $this->object->form());
}
public function testHidden()
{
$this->assertInstanceOf('Nethgui\Widget\XhtmlWidget', $this->object->hidden('test'));
}
public function testInset()
{
$this->assertInstanceOf('Nethgui\Widget\XhtmlWidget', $this->object->inset('test'));
}
public function testPanel()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\Panel', $this->object->panel('test'));
}
public function testRadioButton()
{
$this->assertInstanceOf('Nethgui\Widget\Xhtml\RadioButton', $this->object->radioButton('radiobutton', 999));
}
public function testSelector()
{
$type = 'Nethgui\Widget\Xhtml\Selector';
$widget = $this->object->selector('selector');
$this->assertInstanceOf($type, $widget);
}
public function testTabs()
{
$type = 'Nethgui\Widget\Xhtml\Tabs';
$widget = $this->object->tabs('tabs');
$this->assertInstanceOf($type, $widget);
}
public function testTextInput()
{
$type = 'Nethgui\Widget\Xhtml\TextInput';
$widget = $this->object->textInput('inputText');
$this->assertInstanceOf($type, $widget);
}
public function testTextLabel()
{
$type = 'Nethgui\Widget\Xhtml\TextLabel';
$widget = $this->object->textLabel('label');
$this->assertInstanceOf($type, $widget);
}
public function testFieldset1()
{
$type = 'Nethgui\Widget\Xhtml\Fieldset';
$widget = $this->object->fieldset();
$this->assertInstanceOf($type, $widget);
}
public function testFieldset2()
{
$type = 'Nethgui\Widget\Xhtml\Fieldset';
$widget = $this->object->fieldset('fieldset');
$this->assertInstanceOf($type, $widget);
}
public function testHeader()
{
$type = 'Nethgui\Widget\Xhtml\TextLabel';
$widget = $this->object->header('header');
$this->assertInstanceOf($type, $widget);
}
public function testLiteral()
{
$type = 'Nethgui\Widget\Xhtml\Literal';
$widget = $this->object->literal('<data></data>');
$this->assertInstanceOf($type, $widget);
}
public function testColumns()
{
$type = 'Nethgui\Widget\Xhtml\Columns';
$widget = $this->object->columns();
$this->assertInstanceOf($type, $widget);
}
public function testProgressBar()
{
$type = 'Nethgui\Widget\Xhtml\ProgressBar';
$widget = $this->object->progressBar('progress');
$this->assertInstanceOf($type, $widget);
}
public function testTextArea()
{
$type = 'Nethgui\Widget\Xhtml\TextArea';
$widget = $this->object->textArea('textarea');
$this->assertInstanceOf($type, $widget);
}
public function testConsole()
{
$type = 'Nethgui\Widget\Xhtml\TextArea';
$widget = $this->object->console('console');
$this->assertInstanceOf($type, $widget);
}
public function testDateInput()
{
$type = 'Nethgui\Widget\Xhtml\TextInput';
$widget = $this->object->dateInput('date');
$this->assertInstanceOf($type, $widget);
}
public function testObjectPicker()
{
$type = 'Nethgui\Widget\Xhtml\ObjectPicker';
$widget = $this->object->objectPicker('picker');
$this->assertInstanceOf($type, $widget);
}
public function testGetCommandList()
{
$type = '\Nethgui\View\ViewCommandInterface';
$o = $this->object->getCommandList();
$this->assertInstanceOf($type, $o);
}
}