<commit_before><?php

namespace WsdlToPhp\PackageGenerator\Tests\DomHandler;

use WsdlToPhp\PackageGenerator\Tests\TestCase;

class AttributeHandlerTest extends TestCase
{
    /**
     *
     */
    public function testGetName()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        // first element tag
        $element = $domDocument->getElementByName('element');

        $this->assertEquals('minOccurs', $element->getAttribute('minOccurs')->getName());
        $this->assertEquals('maxOccurs', $element->getAttribute('maxOccurs')->getName());
        $this->assertEquals('name', $element->getAttribute('name')->getName());
        $this->assertEquals('default', $element->getAttribute('default')->getName());
    }
    /**
     *
     */
    public function testGetValue()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        // first element tag
        $element = $domDocument->getElementByName('element');

        $this->assertSame(0, $element->getAttribute('minOccurs')->getValue());
        $this->assertSame(1, $element->getAttribute('maxOccurs')->getValue());
        $this->assertSame('Version', $element->getAttribute('name')->getValue());
        $this->assertSame(2.2, $element->getAttribute('default')->getValue());
    }
    /**
     *
     */
    public function testGetValueNamespace()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        $sequence = $domDocument->getElementByName('sequence');
        $elements = $sequence->getChildrenByName('element');

        $namespaces = array(
            'xsd',
            'xsd',
            'xsd',
            'xsd',
            'xsd',
            'tns',
            'xsd',
            'xsd',
            'xsd',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
        );

        foreach ($elements as $index=>$element) {
            $this->assertSame($namespaces[$index], $element->getAttribute('type')->getValueNamespace());
        }
    }
}<commit_msg>add unit test for code coverage<commit_after><?php

namespace WsdlToPhp\PackageGenerator\Tests\DomHandler;

use WsdlToPhp\PackageGenerator\Tests\TestCase;

class AttributeHandlerTest extends TestCase
{
    /**
     *
     */
    public function testGetName()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        // first element tag
        $element = $domDocument->getElementByName('element');

        $this->assertEquals('minOccurs', $element->getAttribute('minOccurs')->getName());
        $this->assertEquals('maxOccurs', $element->getAttribute('maxOccurs')->getName());
        $this->assertEquals('name', $element->getAttribute('name')->getName());
        $this->assertEquals('default', $element->getAttribute('default')->getName());
    }
    /**
     *
     */
    public function testGetValue()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        // first element tag
        $element = $domDocument->getElementByName('element');

        $this->assertSame(0, $element->getAttribute('minOccurs')->getValue());
        $this->assertSame(1, $element->getAttribute('maxOccurs')->getValue());
        $this->assertSame('Version', $element->getAttribute('name')->getValue());
        $this->assertSame(2.2, $element->getAttribute('default')->getValue());
    }
    /**
     *
     */
    public function testGetValueNamespace()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        $sequence = $domDocument->getElementByName('sequence');
        $elements = $sequence->getChildrenByName('element');

        $namespaces = array(
            'xsd',
            'xsd',
            'xsd',
            'xsd',
            'xsd',
            'tns',
            'xsd',
            'xsd',
            'xsd',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
            'tns',
        );

        foreach ($elements as $index=>$element) {
            $this->assertSame($namespaces[$index], $element->getAttribute('type')->getValueNamespace());
        }
    }
    /**
     *
     */
    public function testGetNamespaceNull()
    {
        $domDocument = DomDocumentHandlerTest::bingInstance();

        // first element tag
        $element = $domDocument->getElementByName('element');

        $this->assertNull($element->getAttribute('minOccurs')->getNamespace());
    }
}
{'fraction_non_alphanumeric': 0.16549912434325745, 'fraction_numerical': 0.0017513134851138354, 'mean_word_length': 2.322909090909091, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 71, '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': '119446', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1185, 'n_words': 176}