<commit_before><?php

namespace Simphotonics\Dom\Tests;

use Simphotonics\Dom\HtmlLeaf;
use Simphotonics\Dom\HtmlNode;
use Simphotonics\Dom\HtmlNavigator;

/**
 * @author <NAME> <<EMAIL>>
 * @copyright 2016 Simphotonics
 * Description: Tests Simphotonics\HtmlNavigator using URI's with
 * different format.
 */
class HtmlNavigatorTest extends \PHPUnit_Framework_TestCase
{
    public function __construct()
    {
        HtmlNavigator::registerElements(['a' => 'empty']);
        
    }

    public function testHome()
    {
        $_SERVER['REQUEST_URI'] = '/';
        $nav = self::initNavigator();
        $this->assertEquals('<div id="nav" class="has-shadow"><ul id="mainMenu"><li class="here"><a href="/" HOME/></li><li><a href="/services" SERVICES/></li></ul></div>', "$nav");
    }

    public function testServices()
    {
        $_SERVER['REQUEST_URI'] = '/services';
        $nav = self::initNavigator();
        $this->assertEquals('<div id="nav" class="has-shadow"><ul id="mainMenu"><li><a href="/" HOME/></li><li class="here"><a href="/services" SERVICES/></li></ul></div>', "$nav");
    }
    
    /**
     * Initialises HtmlNavigator object.
     * @method  initNavigator
     * @return  void
     */
    private static function initNavigator()
    {
        // Templates
        $L = new HtmlLeaf([
        'kind' => 'a'
        ]);
        $B = new HtmlNode([
        'kind' => 'li',
        'child' => [$L]
        ]);
        // Home
        $B_home = clone $B;
        $B_home[0]->setAttr(['href' => '/'])->setCont('HOME');
        // Services
        $B_services = clone $B;
        $B_services[0]->setAttr(['href' => '/services'])->setCont('SERVICES');

        $Menu = new HtmlNode([
        'kind' => 'ul',
        'attr' => ['id' => 'mainMenu'],<commit_msg>Changed anchor elements 'a' from format 'empty' to 'block'.<commit_after><?php

namespace Simphotonics\Dom\Tests;

use Simphotonics\Dom\HtmlLeaf;
use Simphotonics\Dom\HtmlNode;
use Simphotonics\Dom\HtmlNavigator;

/**
 * @author <NAME> <<EMAIL>>
 * @copyright 2016 Simphotonics
 * Description: Tests Simphotonics\HtmlNavigator using URI's with
 * different format.
 */
class HtmlNavigatorTest extends \PHPUnit_Framework_TestCase
{
    public function testHome()
    {
        $_SERVER['REQUEST_URI'] = '/';
        $nav = self::initNavigator();
        $this->assertEquals('<div id="nav" class="has-shadow"><ul id="mainMenu"><li class="here"><a href="/">HOME</a></li><li><a href="/services">SERVICES</a></li></ul></div>', "$nav");
    }

    public function testServices()
    {
        $_SERVER['REQUEST_URI'] = '/services';
        $nav = self::initNavigator();
        $this->assertEquals('<div id="nav" class="has-shadow"><ul id="mainMenu"><li><a href="/">HOME</a></li><li class="here"><a href="/services">SERVICES</a></li></ul></div>', "$nav");
    }
    
    /**
     * Initialises HtmlNavigator object.
     * @method  initNavigator
     * @return  void
     */
    private static function initNavigator()
    {
        // Templates
        $L = new HtmlLeaf([
        'kind' => 'a'
        ]);
        $B = new HtmlNode([
        'kind' => 'li',
        'child' => [$L]
        ]);
        // Home
        $B_home = clone $B;
        $B_home[0]->setAttr(['href' => '/'])->setCont('HOME');
        // Services
        $B_services = clone $B;
        $B_services[0]->setAttr(['href' => '/services'])->setCont('SERVICES');

        $Menu = new HtmlNode([
        'kind' => 'ul',
        'attr' => ['id' => 'mainMenu'],
{'fraction_non_alphanumeric': 0.19846022241231823, 'fraction_numerical': 0.003421727972626176, 'mean_word_length': 2.7161016949152543, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 82, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1434765', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1100, 'n_words': 216}