<commit_before><?php

namespace WsdlToPhp\PackageGenerator\Tests\Parser\Wsdl;

use WsdlToPhp\PackageGenerator\Container\Model\Schema as SchemaContainer;
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagImport;
use WsdlToPhp\PackageGenerator\Generator\Generator;
use WsdlToPhp\PackageGenerator\Model\Wsdl;
use WsdlToPhp\PackageGenerator\Model\Schema;
use WsdlToPhp\PackageGenerator\DomHandler\Wsdl\Wsdl as WsdlDocument;

class TagImportTest extends WsdlParser
{
    /**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagImport
     */
    public static function instance()
    {
        return new TagImport(new Generator(self::wsdlPartnerPath()));
    }
    /**
     *
     */
    public function testIsWsdlParsed()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertTrue($tagImportParser->isWsdlParsed(new Wsdl(self::wsdlPartnerPath(), file_get_contents(self::wsdlPartnerPath()))));
    }
    /**
     *
     */
    public function testCountWsdlsAfterParsing()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertCount(1, $tagImportParser->getGenerator()->getWsdls());
    }
    /**
     *
     */
    public function testGetExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $schemaContainer = new SchemaContainer();
        for ($i=0; $i<19; $i++) {
            $schemaPath = sprintf(dirname(__FILE__) . '/../../resources/PartnerService.%d.xsd', $i);
            $schema = new Schema($schemaPath, file_get_contents($schemaPath));
            $schema->getContent()->setCurrentTag('import');
            $schemaContainer->add($schema);
        }

        $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getExternalSchemas()->rewind();
        $this->assertEquals($schemaContainer, $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getExternalSchemas());
    }
    /**
     *
     */
    public function testGetRestrictionFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagRestriction', $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementByName(WsdlDocument::TAG_RESTRICTION, true));
    }
    /**
     *
     */
    public function testGetEnumerationByAttributesFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagEnumeration', $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementByNameAndAttributes(WsdlDocument::TAG_ENUMERATION, array(
            'value' => 'InternalServerError',
        ), true));
    }
    /**
     *
     */
    public function testGetElementsFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();
        $restrictions = $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementsByName(WsdlDocument::TAG_RESTRICTION, true);

        $this->assertNotEmpty($restrictions);
        $this->assertContainsOnlyInstancesOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagRestriction', $restrictions);
    }
    /**
     *
     */
    public function testGetElementsByAttributeFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();
        $elements = $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementsByNameAndAttributes(WsdlDocument::TAG_ELEMENT, array(
            'name' => 'PartnerCredentials',
        ), true);

        $this->assertNotEmpty($elements);
        $this->assertContainsOnlyInstancesOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagElement', $elements);
    }
}<commit_msg>fix call to method as it changed<commit_after><?php

namespace WsdlToPhp\PackageGenerator\Tests\Parser\Wsdl;

use WsdlToPhp\PackageGenerator\Container\Model\Schema as SchemaContainer;
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagImport;
use WsdlToPhp\PackageGenerator\Generator\Generator;
use WsdlToPhp\PackageGenerator\Model\Wsdl;
use WsdlToPhp\PackageGenerator\Model\Schema;
use WsdlToPhp\PackageGenerator\DomHandler\Wsdl\Wsdl as WsdlDocument;

class TagImportTest extends WsdlParser
{
    /**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagImport
     */
    public static function instance()
    {
        return new TagImport(new Generator(self::wsdlPartnerPath()));
    }
    /**
     *
     */
    public function testIsWsdlParsed()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertTrue($tagImportParser->isWsdlParsed(new Wsdl(self::wsdlPartnerPath(), file_get_contents(self::wsdlPartnerPath()))));
    }
    /**
     *
     */
    public function testCountWsdlsAfterParsing()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertCount(1, $tagImportParser->getGenerator()->getWsdls());
    }
    /**
     *
     */
    public function testGetExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $schemaContainer = new SchemaContainer();
        for ($i=0; $i<19; $i++) {
            $schemaPath = sprintf(dirname(__FILE__) . '/../../resources/PartnerService.%d.xsd', $i);
            $schema = new Schema($schemaPath, file_get_contents($schemaPath));
            $schema->getContent()->setCurrentTag('import');
            $schemaContainer->add($schema);
        }

        $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getExternalSchemas()->rewind();
        $this->assertEquals($schemaContainer, $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getExternalSchemas());
    }
    /**
     *
     */
    public function testGetRestrictionFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagRestriction', $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementByName(WsdlDocument::TAG_RESTRICTION, true));
    }
    /**
     *
     */
    public function testGetEnumerationByAttributesFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();

        $this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagEnumeration', $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementByNameAndAttributes(WsdlDocument::TAG_ENUMERATION, array(
            'value' => 'InternalServerError',
        ), true));
    }
    /**
     *
     */
    public function testGetElementsFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();
        $restrictions = $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementsByName(WsdlDocument::TAG_RESTRICTION, true);

        $this->assertNotEmpty($restrictions);
        $this->assertContainsOnlyInstancesOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagRestriction', $restrictions);
    }
    /**
     *
     */
    public function testGetElementsByAttributeFromExternalSchemas()
    {
        $tagImportParser = self::instance();

        $tagImportParser->parse();
        $elements = $tagImportParser->getGenerator()->getWsdl(0)->getContent()->getElementsByNameAndAttributes(WsdlDocument::TAG_ELEMENT, array(
            'name' => 'PartnerCredentials',
        ), null, true);

        $this->assertNotEmpty($elements);
        $this->assertContainsOnlyInstancesOf('\\WsdlToPhp\\PackageGenerator\\DomHandler\\Wsdl\\Tag\\TagElement', $elements);
    }
}
{'fraction_non_alphanumeric': 0.14987902712339232, 'fraction_numerical': 0.0025467974022666496, 'mean_word_length': 3.3926174496644297, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 101, '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': '5537040', 'n_tokens_mistral': 2357, 'n_tokens_neox': 2247, 'n_words': 255}