From 787114e73dfdb800a0fef796690696f92167c019 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 23 Oct 2009 07:13:20 -0400 Subject: [PATCH] add test for node cleaning --- test/WhatDidTheySayAdminTest.php | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/WhatDidTheySayAdminTest.php b/test/WhatDidTheySayAdminTest.php index d08a4f6..0a0295d 100644 --- a/test/WhatDidTheySayAdminTest.php +++ b/test/WhatDidTheySayAdminTest.php @@ -128,6 +128,56 @@ class WhatDidTheySayAdminTest extends PHPUnit_Framework_TestCase { $this->assertEquals(false, $admin->import_transcripts('en')); } + + function providerTestCleanChild() { + return array( + array( + array( + 'script' => 'test', + 'style' => 'test', + 'link' => 'removetest', + 'keep' => 'removetest' + ), + array( + 'allow_html' => true + ), + array( + 'script' => 'test', + 'style' => 'test', + 'link' => 'test', + 'keep' => 'removetest' + ), + ), + array( + array( + 'remove' => 'removetest', + 'children' => array( + 'alsoremove' => 'removetest' + ) + ), + array( + 'allow_html' => false + ), + array( + 'remove' => 'removetest', + 'children' => array( + 'alsoremove' => 'removetest', + ) + ), + ), + ); + } + + /** + * @dataProvider providerTestCleanChild + */ + function testCleanChild($nodes, $options, $expected_result) { + $admin = new WhatDidTheySayAdmin(); + + update_option('what-did-they-say-options', $options); + + $this->assertEquals($expected_result, $admin->_clean_child($nodes)); + } } ?> \ No newline at end of file