<commit_before><?php

require_once 'PHPUnit/Framework.php';
require_once '../src/simplepie.php';

class nodeToHTMLTest extends PHPUnit_Framework_TestCase
{
    public function basicXML()
    {
        return array(
            array(
                '<foo/>',
                '<foo></foo>'
            ),
            array(
                '<foo>Test</foo>',
                '<foo>Test</foo>'
            ),
            array(
                '<foo><bar>Test</bar></foo>',
                '<foo><bar>Test</bar></foo>'
            ),
            array(
                '<foo><bar/>Test</foo>',
                '<foo><bar></bar>Test</foo>'
            ),
            array(
                '<foo><a><b/></a>Test</foo>',
                '<foo><a><b></b></a>Test</foo>'
            ),
            array(
                '<foo><a><b><c/></b></a>Test</foo>',
                '<foo><a><b><c></c></b></a>Test</foo>'
            ),
            array(
                '<html xmlns="http://www.w3.org/1999/xhtml"/>',
                '<html xmlns="http://www.w3.org/1999/xhtml"></html>'
            ),
            array(
                '<a href="http://example.com">Test</a>',
                '<a href="http://example.com">Test</a>'
            )
        );
    }
    
    /**
     * @dataProvider basicXML
     */
    public function testXML($xml, $expected)
    {
        $dom = new \DOMDocument;
        $dom->loadXML($xml);
        $this->assertSame($expected, \ComplexPie\nodeToHTML($dom->documentElement));
    }
    
    public function basicHTML()
    {
        return array(
            array(
                '<html><head><body><p>Test</p>',
                '<html><head></head><body><p>Test</p></body></html>'
            ),
            array(
                '<html><head><body><a href="http://example.com">Test</a>',
                '<html><head></head><body><a href="http://example.com">Test</a></body></html>'
            ),
            array(
                '<html><head><body><img src="http://example.com">',
                '<html><head></head><body><img src="http://example.com"></body></html>'
            ),
            array(
                '<html><head><body><img src="http://example.com"><p>Test',<commit_msg>Add a basic test for comment serialization.<commit_after><?php

require_once 'PHPUnit/Framework.php';
require_once '../src/simplepie.php';

class nodeToHTMLTest extends PHPUnit_Framework_TestCase
{
    public function basicXML()
    {
        return array(
            array(
                '<foo/>',
                '<foo></foo>'
            ),
            array(
                '<foo>Test</foo>',
                '<foo>Test</foo>'
            ),
            array(
                '<foo><bar>Test</bar></foo>',
                '<foo><bar>Test</bar></foo>'
            ),
            array(
                '<foo><bar/>Test</foo>',
                '<foo><bar></bar>Test</foo>'
            ),
            array(
                '<foo><a><b/></a>Test</foo>',
                '<foo><a><b></b></a>Test</foo>'
            ),
            array(
                '<foo><a><b><c/></b></a>Test</foo>',
                '<foo><a><b><c></c></b></a>Test</foo>'
            ),
            array(
                '<html xmlns="http://www.w3.org/1999/xhtml"/>',
                '<html xmlns="http://www.w3.org/1999/xhtml"></html>'
            ),
            array(
                '<a href="http://example.com">Test</a>',
                '<a href="http://example.com">Test</a>'
            ),
            array(
                '<a><!--foo--></a>',
                '<a><!--foo--></a>'
            )
        );
    }
    
    /**
     * @dataProvider basicXML
     */
    public function testXML($xml, $expected)
    {
        $dom = new \DOMDocument;
        $dom->loadXML($xml);
        $this->assertSame($expected, \ComplexPie\nodeToHTML($dom->documentElement));
    }
    
    public function basicHTML()
    {
        return array(
            array(
                '<html><head><body><p>Test</p>',
                '<html><head></head><body><p>Test</p></body></html>'
            ),
            array(
                '<html><head><body><a href="http://example.com">Test</a>',
                '<html><head></head><body><a href="http://example.com">Test</a></body></html>'
            ),
            array(
                '<html><head><body><img src="http://example.com">',
                '<html><head></head><body><img src="http://example.com"></body></html>'
            ),
            array(
                '<html><head><body><img src="http://example.com"><p>Test',
{'fraction_non_alphanumeric': 0.2109051254089422, 'fraction_numerical': 0.004362050163576881, 'mean_word_length': 1.3493852459016393, 'pattern_counts': {'":': 0, '<': 205, '<?xml version=': 0, '>': 209, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4520276', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1355, 'n_words': 158}