<commit_before><?php

namespace WsdlToPhp\PackageGenerator\Tests\DomHandler\Wsdl\Tag;

use WsdlToPhp\PackageGenerator\Tests\TestCase;
use WsdlToPhp\PackageGenerator\Tests\Model\WsdlTest;
use WsdlToPhp\PackageGenerator\DomHandler\Wsdl\Wsdl;

class TagAttributeGroupTest extends TestCase
{
    /**
     *
     */
    public function testGetAttributeRef()
    {
        $schema = WsdlTest::whlInstance();
        $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP);
        $attributeRefs = array(
            'PrimaryLangID_Group',
            'ID_Group',
            'CurrencyAmountGroup',
            'CurrencyCodeGroup',
            'PrivacyGroup',
            'TelephoneAttributesGroup',
            'FormattedInd',
            'TelephoneGroup',
            'DefaultIndGroup',
            'LanguageGroup',
            'ErrorWarningAttributeGroup',
            'ErrorWarningAttributeGroup',
            'CompanyID_AttributesGroup',
            'UniqueID_Group',
            'OTA_PayloadStdAttributes',
            'BookingChannelGroup',
            'ID_OptionalGroup',
            'CurrencyAmountGroup',
            'FeeTaxGroup',
            'IssuerNameGroup',
            'TelephoneInfoGroup',
            'PrivacyGroup',
            'PaymentCardDateGroup',
            'FormattedInd',
            'PrivacyGroup',
            'PrivacyGroup',
            'DefaultIndGroup',
            'PrivacyGroup',
            'TelephoneInfoGroup',
            'PrivacyGroup',
            'DefaultIndGroup',
            'FeeTaxGroup',
            'ChargeUnitGroup',
            'PrivacyGroup',
            'PrivacyGroup',
            'DefaultIndGroup',
            'MultimediaDescriptionGroup',
            'ID_OptionalGroup',
            'MultimediaItemGroup',
            'ID_OptionalGroup',
            'MultimediaDescriptionGroup',
            'MultimediaDescriptionGroup',
            'DateTimeSpanGroup',
            'CurrencyCodeGroup',
            'TelephoneInfoGroup',
            'CitizenCountryNameGroup',
            'GenderGroup',
            'BirthDateGroup',
            'CurrencyCodeGroup',
            'ProfileTypeGroup',
            'DateTimeSpanGroup',
            'RatePlanGroup',
            'InventoryGroup',
            'CodeInfoGroup',
            'CodeInfoGroup',
            'CodeInfoGroup',
            'PositionGroup',
            'DeadlineGroup',
            'CurrencyAmountGroup',
            'CurrencyCodeGroup',
            'ID_OptionalGroup',
            'CodeInfoGroup',
            'GenderGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'TelephoneInfoGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'PositionGroup',
            'ID_OptionalGroup',
            'RoomGroup',
            'CodeInfoGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'ID_Group',
            'GuestCountGroup',
            'HotelReferenceGroup',
            'ID_Group',
            'CurrencyCodeGroup',
            'HotelReferenceGroup',
            'StatusApplicationGroup',
            'RestrictionStatusGroup',
            'OTA_PayloadStdAttributes',
            'RoomGroup',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'HotelReferenceGroup',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'HotelReferenceGroup',
            'OTA_PayloadStdAttributes'
        );
        $indexRef = 0;
        foreach ($attributeGroups as $attributeGroup) {
            if ($attributeGroup->getAttributeRef() !== '') {
                $this->assertSame($attributeRefs[$indexRef++], $attributeGroup->getAttributeRef());
            }
        }
    }
    /**
     *
     */
    public function testGetAttributeName()
    {
        $schema = WsdlTest::whlInstance();
        $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP);
        $attributeNames = array(
            'ErrorWarningAttributeGroup',
            'LanguageGroup',
            'PrimaryLangID_Group',
            'OTA_PayloadStdAttributes',
            'CompanyID_AttributesGroup',
            'UniqueID_Group',
            'ID_Group',
            'PositionGroup',
            'BookingChannelGroup',
            'NameOptionalCodeGroup',
            'CodeInfoGroup',
            'DeadlineGroup',
            'FeeTaxGroup',
            'CurrencyAmountGroup',
            'CurrencyCodeGroup',
            'IssuerNameGroup',
            'FormattedInd',
            'PrivacyGroup',
            'TelephoneAttributesGroup',
            'TelephoneGroup',
            'TelephoneInfoGroup',
            'DefaultIndGroup',
            'PaymentCardDateGroup',
            'GenderGroup',
            'MultimediaItemGroup',
            'MultimediaDescriptionGroup',
            'RoomGroup',
            'ID_OptionalGroup',
            'ChargeUnitGroup',
            'DateTimeSpanGroup',
            'GuestCountGroup',
            'BirthDateGroup',
            'ProfileTypeGroup',
            'CitizenCountryNameGroup',
            'HotelReferenceGroup',
            'RestrictionStatusGroup',
            'InventoryGroup',
            'RatePlanGroup',
            'StatusApplicationGroup'
        );
        $indexName = 0;
        foreach ($attributeGroups as $attributeGroup) {
            if ($attributeGroup->getAttributeName() !== '') {
                $this->assertSame($attributeNames[$indexName++], $attributeGroup->getAttributeName());
            }
        }
    }
}<commit_msg>issue #82 - initialize unit test on getReferencingElements method<commit_after><?php

namespace WsdlToPhp\PackageGenerator\Tests\DomHandler\Wsdl\Tag;

use WsdlToPhp\PackageGenerator\Tests\TestCase;
use WsdlToPhp\PackageGenerator\Tests\Model\WsdlTest;
use WsdlToPhp\PackageGenerator\DomHandler\Wsdl\Wsdl;

class TagAttributeGroupTest extends TestCase
{
    /**
     *
     */
    public function testGetAttributeRef()
    {
        $schema = WsdlTest::whlInstance();
        $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP);
        $attributeRefs = array(
            'PrimaryLangID_Group',
            'ID_Group',
            'CurrencyAmountGroup',
            'CurrencyCodeGroup',
            'PrivacyGroup',
            'TelephoneAttributesGroup',
            'FormattedInd',
            'TelephoneGroup',
            'DefaultIndGroup',
            'LanguageGroup',
            'ErrorWarningAttributeGroup',
            'ErrorWarningAttributeGroup',
            'CompanyID_AttributesGroup',
            'UniqueID_Group',
            'OTA_PayloadStdAttributes',
            'BookingChannelGroup',
            'ID_OptionalGroup',
            'CurrencyAmountGroup',
            'FeeTaxGroup',
            'IssuerNameGroup',
            'TelephoneInfoGroup',
            'PrivacyGroup',
            'PaymentCardDateGroup',
            'FormattedInd',
            'PrivacyGroup',
            'PrivacyGroup',
            'DefaultIndGroup',
            'PrivacyGroup',
            'TelephoneInfoGroup',
            'PrivacyGroup',
            'DefaultIndGroup',
            'FeeTaxGroup',
            'ChargeUnitGroup',
            'PrivacyGroup',
            'PrivacyGroup',
            'DefaultIndGroup',
            'MultimediaDescriptionGroup',
            'ID_OptionalGroup',
            'MultimediaItemGroup',
            'ID_OptionalGroup',
            'MultimediaDescriptionGroup',
            'MultimediaDescriptionGroup',
            'DateTimeSpanGroup',
            'CurrencyCodeGroup',
            'TelephoneInfoGroup',
            'CitizenCountryNameGroup',
            'GenderGroup',
            'BirthDateGroup',
            'CurrencyCodeGroup',
            'ProfileTypeGroup',
            'DateTimeSpanGroup',
            'RatePlanGroup',
            'InventoryGroup',
            'CodeInfoGroup',
            'CodeInfoGroup',
            'CodeInfoGroup',
            'PositionGroup',
            'DeadlineGroup',
            'CurrencyAmountGroup',
            'CurrencyCodeGroup',
            'ID_OptionalGroup',
            'CodeInfoGroup',
            'GenderGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'TelephoneInfoGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'PositionGroup',
            'ID_OptionalGroup',
            'RoomGroup',
            'CodeInfoGroup',
            'ID_OptionalGroup',
            'ID_OptionalGroup',
            'ID_Group',
            'GuestCountGroup',
            'HotelReferenceGroup',
            'ID_Group',
            'CurrencyCodeGroup',
            'HotelReferenceGroup',
            'StatusApplicationGroup',
            'RestrictionStatusGroup',
            'OTA_PayloadStdAttributes',
            'RoomGroup',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'HotelReferenceGroup',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'OTA_PayloadStdAttributes',
            'HotelReferenceGroup',
            'OTA_PayloadStdAttributes',
        );
        $indexRef = 0;
        foreach ($attributeGroups as $attributeGroup) {
            if ($attributeGroup->getAttributeRef() !== '') {
                $this->assertSame($attributeRefs[$indexRef++], $attributeGroup->getAttributeRef());
            }
        }
    }
    /**
     *
     */
    public function testGetAttributeName()
    {
        $schema = WsdlTest::whlInstance();
        $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP);
        $attributeNames = array(
            'ErrorWarningAttributeGroup',
            'LanguageGroup',
            'PrimaryLangID_Group',
            'OTA_PayloadStdAttributes',
            'CompanyID_AttributesGroup',
            'UniqueID_Group',
            'ID_Group',
            'PositionGroup',
            'BookingChannelGroup',
            'NameOptionalCodeGroup',
            'CodeInfoGroup',
            'DeadlineGroup',
            'FeeTaxGroup',
            'CurrencyAmountGroup',
            'CurrencyCodeGroup',
            'IssuerNameGroup',
            'FormattedInd',
            'PrivacyGroup',
            'TelephoneAttributesGroup',
            'TelephoneGroup',
            'TelephoneInfoGroup',
            'DefaultIndGroup',
            'PaymentCardDateGroup',
            'GenderGroup',
            'MultimediaItemGroup',
            'MultimediaDescriptionGroup',
            'RoomGroup',
            'ID_OptionalGroup',
            'ChargeUnitGroup',
            'DateTimeSpanGroup',
            'GuestCountGroup',
            'BirthDateGroup',
            'ProfileTypeGroup',
            'CitizenCountryNameGroup',
            'HotelReferenceGroup',
            'RestrictionStatusGroup',
            'InventoryGroup',
            'RatePlanGroup',
            'StatusApplicationGroup',
        );
        $indexName = 0;
        foreach ($attributeGroups as $attributeGroup) {
            if ($attributeGroup->getAttributeName() !== '') {
                $this->assertSame($attributeNames[$indexName++], $attributeGroup->getAttributeName());
            }
        }
    }
    /**
     *
     */
    public function testGetReferencingElements()
    {
        $schema = WsdlTest::whlInstance();
        $attributeGroups = $schema->getContent()->getElementsByName(Wsdl::TAG_ATTRIBUTE_GROUP);
        foreach ($attributeGroups as $attributeGroup) {
            if ($attributeGroup->getAttributeName() !== '') {
                switch($attributeGroup->getAttributeName()) {
                    case 'ErrorWarningAttributeGroup':
                        $this->assertCount(2, $attributeGroup->getReferencingElements());
                        break;
            }
        }
    }
}
}
{'fraction_non_alphanumeric': 0.10053032049804012, 'fraction_numerical': 0.000538006302359542, 'mean_word_length': 1.7626326963906582, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '7552983', 'n_tokens_mistral': 3221, 'n_tokens_neox': 3155, 'n_words': 418}