<?php

require_once dirname(__FILE__) . '/vendor/lime.php';
require_once dirname(__FILE__) . '/../lib/phpHtmlWriter.php';
require_once dirname(__FILE__) . '/phpHtmlWriterTestHelper.php';
$tests = array(array('params' => array('div'), 'result' => '</div>'), array('params' => array(null), 'throws' => 'InvalidArgumentException'), array('params' => array(' '), 'throws' => 'InvalidArgumentException'), array('params' => array(array()), 'throws' => 'InvalidArgumentException'), array('params' => array('#my_id'), 'throws' => 'InvalidArgumentException'), array('params' => array('.my_class.another.class'), 'throws' => 'InvalidArgumentException'), array('params' => array('input'), 'throws' => 'LogicException'), array('params' => array('p#my_id'), 'result' => '</p>'), array('params' => array('p.my_class'), 'result' => '</p>'), array('params' => array('p.my_class.another_class'), 'result' => '</p>'), array('params' => array('p#my_id.my_class.another_class'), 'result' => '</p>'), array('params' => array(' p#my_id.my_class.another_class '), 'result' => '</p>'), array('params' => array('div', array('id' => 'my_id')), 'result' => '</div>'), array('params' => array('p', array('class' => 'my_class')), 'result' => '</p>'), array('params' => array('p', array('class' => 'my_class another_class')), 'result' => '</p>'), array('params' => array('p', array('id' => 'my_id', 'class' => 'my_class another_class')), 'result' => '</p>'), array('params' => array(' p ', array('id' => ' my_id ', 'class' => ' my_class another_class ')), 'result' => '</p>'), array('params' => array('a', array('href' => 'http://diem-project.org/')), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class', array('href' => 'http://diem-project.org/')), 'result' => '</a>'), array('params' => array('div', array('id' => ' my_id ', 'class' => ' my_class another_class ')), 'result' => '</div>'), array('params' => array('a#my_id.my_class.another_class', array('href' => 'http://diem-project.org/')), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class', array('id' => 'changed_id', 'href' => 'http://diem-project.org/')), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class', array('class' => 'added_class other_added_class', 'href' => 'http://diem-project.org/')), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class', array('class' => 'added_class other_added_class my_class', 'href' => 'http://diem-project.org/', 'title' => 'my title')), 'result' => '</a>'), array('params' => array('a href="http://diem-project.org/"'), 'result' => '</a>'), array('params' => array('a class=my_class'), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class href="http://diem-project.org/"'), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class id=changed_id href="http://diem-project.org/"'), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class class="added_class other_added_class" href="http://diem-project.org/"'), 'result' => '</a>'), array('params' => array('a#my_id.my_class.another_class class="added_class other_added_class my_class" href="http://diem-project.org/" title="my title"'), 'result' => '</a>'));
$t = new lime_test(count($tests));
php_html_writer_run_tests($t, $tests, array(new phpHtmlWriter(), 'close'));
<?php

require_once dirname(__FILE__) . '/vendor/lime.php';
require_once dirname(__FILE__) . '/../lib/parser/phpHtmlWriterCssExpressionParser.php';
require_once dirname(__FILE__) . '/phpHtmlWriterTestHelper.php';
$tests = array(array('params' => array(null), 'throws' => 'InvalidArgumentException'), array('params' => array(array()), 'throws' => 'InvalidArgumentException'), array('params' => array(' '), 'result' => array(null, array())), array('params' => array('div'), 'result' => array('div', array())), array('params' => array(' input '), 'result' => array('input', array())), array('params' => array('p#my_id'), 'result' => array('p', array('id' => 'my_id'))), array('params' => array('p.my_class'), 'result' => array('p', array('class' => 'my_class'))), array('params' => array('p.my_class.another_class'), 'result' => array('p', array('class' => 'my_class another_class'))), array('params' => array('p#my_id.my_class.another_class'), 'result' => array('p', array('id' => 'my_id', 'class' => 'my_class another_class'))), array('params' => array(' p#my_id.my_class.another_class '), 'result' => array('p', array('id' => 'my_id', 'class' => 'my_class another_class'))), array('params' => array('p#my_id rel=my_rel title="my title"'), 'result' => array('p', array('id' => 'my_id'))), array('params' => array('p.my_class rel=my_rel title="my title"'), 'result' => array('p', array('class' => 'my_class'))), array('params' => array('p.my_class.another_class rel=my_rel title="my title"'), 'result' => array('p', array('class' => 'my_class another_class'))), array('params' => array('p#my_id.my_class.another_class rel=my_rel title="my title"'), 'result' => array('p', array('id' => 'my_id', 'class' => 'my_class another_class'))), array('params' => array(' p#my_id.my_class.another_class  rel=my_rel  title="my title" '), 'result' => array('p', array('id' => 'my_id', 'class' => 'my_class another_class'))), array('params' => array('p rel=my_rel title="my title"'), 'result' => array('p', array())), array('params' => array(' p  rel=my_rel  title="my title" '), 'result' => array('p', array())), array('params' => array('#my_id rel=my_rel title="my title"'), 'result' => array(null, array('id' => 'my_id'))), array('params' => array('.my_class rel=my_rel title="my title"'), 'result' => array(null, array('class' => 'my_class'))), array('params' => array('.my_class.another_class rel=my_rel title="my title"'), 'result' => array(null, array('class' => 'my_class another_class'))), array('params' => array('#my_id.my_class.another_class rel=my_rel title="my title"'), 'result' => array(null, array('id' => 'my_id', 'class' => 'my_class another_class'))), array('params' => array(' #my_id.my_class.another_class   rel=my_rel  title="my title" '), 'result' => array(null, array('id' => 'my_id', 'class' => 'my_class another_class'))), array('params' => array('rel=my_rel title="my title"'), 'result' => array(null, array())), array('params' => array('  rel=my_rel  title="my title" '), 'result' => array(null, array())));
$t = new lime_test(count($tests));
php_html_writer_run_tests($t, $tests, array(new phpHtmlWriterCssExpressionParser(), 'parse'));
<?php

require_once dirname(__FILE__) . '/vendor/lime.php';
require_once dirname(__FILE__) . '/../lib/parser/phpHtmlWriterAttributeArrayParser.php';
require_once dirname(__FILE__) . '/phpHtmlWriterTestHelper.php';
$tests = array(array('params' => array(array()), 'result' => array()), array('params' => array(array('rel' => 'my_rel')), 'result' => array('rel' => 'my_rel')), array('params' => array(array('rel' => 'my_rel', 'title' => 'my title', 'class' => 'class1 class2')), 'result' => array('rel' => 'my_rel', 'title' => 'my title', 'class' => 'class1 class2')), array('params' => array(array('rel' => 'my_rel', 'class' => array())), 'result' => array('rel' => 'my_rel', 'class' => '')), array('params' => array(array('rel' => 'my_rel', 'class' => array('class1'))), 'result' => array('rel' => 'my_rel', 'class' => 'class1')), array('params' => array(array('rel' => 'my_rel', 'class' => array('class1', 'class2'))), 'result' => array('rel' => 'my_rel', 'class' => 'class1 class2')));
$t = new lime_test(count($tests));
php_html_writer_run_tests($t, $tests, array(new phpHtmlWriterAttributeArrayParser(), 'parse'));