<commit_before><?php

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

use Oro\Bundle\IntegrationBundle\Provider\AbstractConnector;

class AbstractConnectorTest extends \PHPUnit_Framework_TestCase
{
    /** @var AbstractConnector */
    protected $connector;

    /** @var \PHPUnit_Framework_MockObject_MockObject */
    protected $transport;

    /** @var \PHPUnit_Framework_MockObject_MockObject */
    protected $realTransport;

    /**
     * Setup test entity
     */
    public function setUp()
    {
        $this->connector = $this->getMockForAbstractClass('Oro\Bundle\IntegrationBundle\Provider\AbstractConnector');

        $this->transport = $this->getMock('Oro\Bundle\IntegrationBundle\Entity\Transport');
        $this->realTransport = $this->getMock('Oro\Bundle\IntegrationBundle\Provider\TransportInterface');
    }

    /**
     * Tear down setup objects
     */
    public function tearDown()
    {
        unset($this->connector, $this->transport, $this->realTransport);
    }

    /**
     * Test connect method
     */
    public function testConnect()
    {
        $this->connector->configure($this->realTransport, $this->transport);
        $params = $this->getMock('Symfony\Component\HttpFoundation\ParameterBag');

        $this->transport->expects($this->once())
            ->method('getSettingsBag')
            ->will($this->returnValue($params));

        $this->realTransport->expects($this->once())
            ->method('init')
            ->with($params)
            ->will($this->returnValue(true));

        $this->realTransport->expects($this->once())
            ->method('call');

        $obj = new \ReflectionObject($this->connector);
        $method = $obj->getMethod('call');
        $method->setAccessible(true);
        $method->invoke($this->connector, 'test');
    }

    /**
     * Test init method errors
     *
     * @expectedException \LogicException
     */
    public function testConnectErrors()
    {
        $this->connector->connect();
    }

    /**
     * Test protected method call
     */
    public function estCall()
    {
        $obj = new \ReflectionObject($this->connector);
        $method = $obj->getMethod('call');
        $method->setAccessible(true);
        $method->invoke($this->connector, 'test');
    }
}<commit_msg>CRM-646: Sales and shopping cart data impor    - remove deprecated tests<commit_after><?php

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

use Symfony\Component\HttpKernel\Log\NullLogger;

use Oro\Bundle\ImportExportBundle\Context\ContextRegistry;
use Oro\Bundle\IntegrationBundle\Logger\LoggerStrategy;
use Oro\Bundle\IntegrationBundle\Provider\AbstractConnector;

class AbstractConnectorTest extends \PHPUnit_Framework_TestCase
{
    /** @var AbstractConnector */
    protected $connector;

    /** @var \PHPUnit_Framework_MockObject_MockObject */
    protected $transport;

    /** @var \PHPUnit_Framework_MockObject_MockObject */
    protected $realTransport;

    /**
     * Setup test entity
     */
    public function setUp()
    {
        $loggerStrategy  = new LoggerStrategy(new NullLogger());
        $this->connector = $this->getMockForAbstractClass(
            'Oro\Bundle\IntegrationBundle\Provider\AbstractConnector',
            [new ContextRegistry(), $loggerStrategy]
        );

        $this->transport     = $this->getMock('Oro\Bundle\IntegrationBundle\Entity\Transport');
        $this->realTransport = $this->getMock('Oro\Bundle\IntegrationBundle\Provider\TransportInterface');
    }

    /**
     * Tear down setup objects
     */
    public function tearDown()
    {
        unset($this->connector, $this->transport, $this->realTransport);
    }

    public function testGetLabel()
    {
        $this->assertNull($this->connector->getLabel());
    }
}
{'fraction_non_alphanumeric': 0.13898394314293236, 'fraction_numerical': 0.0007896814951302974, 'mean_word_length': 2.9460020768431985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, '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': '3143604', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1036, 'n_words': 165}