<commit_before><?php
/**
 * User: <NAME> <<EMAIL>>
 */
namespace Praxigento\Core\Setup\Schema;

use Praxigento\Core\Lib\Context;

include_once(__DIR__ . '/../../phpunit_bootstrap.php');

define('TEST_TABLE_NAME', 'table name');

class Base_UnitTest extends \Praxigento\Core\Lib\Test\BaseMockeryCase
{
    /** @var  \Mockery\MockInterface */
    private $mSetup;
    /** @var  \Mockery\MockInterface */
    private $mContext;
    /** @var  \Mockery\MockInterface */
    private $mConn;
    /** @var  \Mockery\MockInterface */
    private $mRepoBasic;
    /** @var  ChildToTest */
    private $obj;

    protected function setUp()
    {
        parent::setUp();
        /* create mocks */
        $this->mConn = $this->_mockConn();
        $this->mRepoBasic = $this->_mockRepoBasic();
        $this->mSetup = $this->_mock(\Magento\Framework\Setup\ModuleDataSetupInterface::class);
        $this->mContext = $this->_mock(\Magento\Framework\Setup\ModuleContextInterface::class);
        /* create object */
        $mResource = $this->_mockResourceConnection($this->mConn);
        $this->obj = new ChildToTest($mResource, $this->mRepoBasic);
    }

    public function test_install()
    {
        /* === Test Data === */
        /* === Setup Mocks === */
        // $setup->startSetup();
        $this->mSetup
            ->shouldReceive('startSetup')->once();
        // $this->_setup();
        // $this->_conn->getTableName(TEST_TABLE_NAME);
        $this->mConn
            ->shouldReceive('getTableName')->once()
            ->with(TEST_TABLE_NAME);
        // $setup->endSetup();
        $this->mSetup
            ->shouldReceive('endSetup')->once();
        /* === Call and asserts  === */
        $this->obj->install($this->mSetup, $this->mContext);
    }

}

class ChildToTest extends Base
{
    protected function _setup()
    {
        $this->_conn->getTableName(TEST_TABLE_NAME);
    }

}<commit_msg>MOBI-265 - unit tests (schema setup)<commit_after><?php
/**
 * User: <NAME> <<EMAIL>>
 */
namespace Praxigento\Core\Setup\Schema;

use Praxigento\Core\Lib\Context;

include_once(__DIR__ . '/../../phpunit_bootstrap.php');

class Base_UnitTest extends \Praxigento\Core\Lib\Test\BaseMockeryCase
{
    /** @var  \Mockery\MockInterface */
    private $mSetup;
    /** @var  \Mockery\MockInterface */
    private $mContext;
    /** @var  \Mockery\MockInterface */
    private $mConn;
    /** @var  \Mockery\MockInterface */
    private $mToolDem;
    /** @var  ChildToTest */
    private $obj;

    protected function setUp()
    {
        parent::setUp();
        /* create mocks */
        $this->mConn = $this->_mockConn();
        $this->mToolDem = $this->_mock(\Praxigento\Core\Setup\Dem\Tool::class);
        $this->mSetup = $this->_mock(\Magento\Framework\Setup\SchemaSetupInterface::class);
        $this->mContext = $this->_mock(\Magento\Framework\Setup\ModuleContextInterface::class);
        /* create object */
        $mResource = $this->_mockResourceConnection($this->mConn);
        $this->obj = new ChildToTest($mResource, $this->mToolDem);
    }

    public function test_install()
    {
        /* === Test Data === */
        /* === Setup Mocks === */
        // $setup->startSetup();
        $this->mSetup
            ->shouldReceive('startSetup')->once();
        // $this->_setup();
        // $this->_toolDem->readDemPackage('pathToFile', 'pathToNode');
        $this->mToolDem
            ->shouldReceive('readDemPackage')->once();
        // $setup->endSetup();
        $this->mSetup
            ->shouldReceive('endSetup')->once();
        /* === Call and asserts  === */
        $this->obj->install($this->mSetup, $this->mContext);
    }

}

class ChildToTest extends Base
{
    protected function _setup()
    {
        $this->_toolDem->readDemPackage('pathToFile', 'pathToNode');
    }

}
{'fraction_non_alphanumeric': 0.17927244176917037, 'fraction_numerical': 0.0007851347814708192, 'mean_word_length': 2.5032080659945004, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 74, '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': '6798662', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1172, 'n_words': 182}