From 7c23451eec050d533d049ee306c1221118e79690 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 14 Feb 2014 12:19:31 +0100 Subject: Added tests for html::attrib_string() method --- tests/Framework/Html.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'tests') diff --git a/tests/Framework/Html.php b/tests/Framework/Html.php index 60284deef..d9466e601 100644 --- a/tests/Framework/Html.php +++ b/tests/Framework/Html.php @@ -18,6 +18,63 @@ class Framework_Html extends PHPUnit_Framework_TestCase $this->assertInstanceOf('html', $object, "Class constructor"); } + /** + * Data for test_attrib_string() + */ + function data_attrib_string() + { + return array( + array( + array(), null, '', + ), + array( + array('test' => 'test'), null, ' test="test"', + ), + array( + array('test' => 'test'), array('test'), ' test="test"', + ), + array( + array('test' => 'test'), array('other'), '', + ), + array( + array('checked' => true), null, ' checked="checked"', + ), + array( + array('checked' => ''), null, '', + ), + array( + array('onclick' => ''), null, '', + ), + array( + array('size' => 5), null, ' size="5"', + ), + array( + array('size' => 'test'), null, '', + ), + array( + array('data-test' => 'test'), null, ' data-test="test"', + ), + array( + array('data-test' => 'test'), array('other'), '', + ), + array( + array('data-test' => 'test'), array('data-test'), ' data-test="test"', + ), + array( + array('data-test' => 'test'), array('data-*'), ' data-test="test"', + ), + ); + } + + /** + * Test for attrib_string() + * @dataProvider data_attrib_string + */ + function test_attrib_string($arg1, $arg2, $result) + { + $this->assertEquals(html::attrib_string($arg1, $arg2), $result); + } + /** * Data for test_quote() */ -- cgit v1.2.3