<commit_before><?php

namespace Oro\Bundle\IntegrationBundle\Tests\Unit\Utils;

use Oro\Bundle\IntegrationBundle\Utils\FormUtils;
use Oro\Bundle\IntegrationBundle\Manager\TypesRegistry;

use Oro\Bundle\IntegrationBundle\Tests\Unit\Fixture\TestChannelType;
use Oro\Bundle\IntegrationBundle\Tests\Unit\Fixture\TestConnector;
use Oro\Bundle\IntegrationBundle\Tests\Unit\Fixture\TestTwoWayConnector;

class FormUtilsTest extends \PHPUnit_Framework_TestCase
{
    /** @var TypesRegistry */
    protected $typesRegistry;

    /** @var FormUtils */
    protected $utils;

    public function setUp()
    {
        $this->typesRegistry = new TypesRegistry();
        $this->utils         = new FormUtils($this->typesRegistry);
    }

    public function tearDown()
    {
        unset($this->utils, $this->typesRegistry);
    }

    public function testHasTwoWaySyncConnectors()
    {
        $testType                  = 'type2';
        $testTypeThatHasConnectors = 'type1';

        $this->typesRegistry->addChannelType($testType, new TestChannelType());
        $this->typesRegistry->addChannelType($testTypeThatHasConnectors, new TestChannelType());
        $this->typesRegistry->addConnectorType(uniqid('type'), $testType, new TestConnector());
        $this->typesRegistry->addConnectorType(uniqid('type'), $testTypeThatHasConnectors, new TestTwoWayConnector());

        $this->assertTrue($this->utils->hasTwoWaySyncConnectors($testTypeThatHasConnectors));
        $this->assertFalse($this->utils->hasTwoWaySyncConnectors($testType));
    }
}
<commit_msg>CRM-1321: Refactor sync commands    - minor unit tests fixesxy<commit_after><?php

namespace Oro\Bundle\IntegrationBundle\Tests\Unit\Utils;

use Oro\Bundle\IntegrationBundle\Utils\FormUtils;
use Oro\Bundle\IntegrationBundle\Manager\TypesRegistry;

use Oro\Bundle\IntegrationBundle\Tests\Unit\Fixture\TestConnector;
use Oro\Bundle\IntegrationBundle\Tests\Unit\Fixture\TestIntegrationType;
use Oro\Bundle\IntegrationBundle\Tests\Unit\Fixture\TestTwoWayConnector;

class FormUtilsTest extends \PHPUnit_Framework_TestCase
{
    /** @var TypesRegistry */
    protected $typesRegistry;

    /** @var FormUtils */
    protected $utils;

    public function setUp()
    {
        $this->typesRegistry = new TypesRegistry();
        $this->utils         = new FormUtils($this->typesRegistry);
    }

    public function tearDown()
    {
        unset($this->utils, $this->typesRegistry);
    }

    public function testHasTwoWaySyncConnectors()
    {
        $testType                  = 'type2';
        $testTypeThatHasConnectors = 'type1';

        $this->typesRegistry->addChannelType($testType, new TestIntegrationType());
        $this->typesRegistry->addChannelType($testTypeThatHasConnectors, new TestIntegrationType());
        $this->typesRegistry->addConnectorType(uniqid('type'), $testType, new TestConnector());
        $this->typesRegistry->addConnectorType(uniqid('type'), $testTypeThatHasConnectors, new TestTwoWayConnector());

        $this->assertTrue($this->utils->hasTwoWaySyncConnectors($testTypeThatHasConnectors));
        $this->assertFalse($this->utils->hasTwoWaySyncConnectors($testType));
    }
}

{'fraction_non_alphanumeric': 0.12456638284452853, 'fraction_numerical': 0.002522863450015768, 'mean_word_length': 4.034920634920635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '3436618', 'n_tokens_mistral': 919, 'n_tokens_neox': 909, 'n_words': 131}