<commit_before><?php
/**
 * User: <NAME> <<EMAIL>>
 */
namespace Praxigento\Bonus\Loyalty\Lib\Test\Story01;

use Praxigento\Accounting\Data\Entity\Account;
use Praxigento\Bonus\Base\Lib\Entity\Calculation;
use Praxigento\Bonus\Base\Lib\Entity\Cfg\Generation;
use Praxigento\Bonus\Base\Lib\Entity\Compress;
use Praxigento\Bonus\Base\Lib\Entity\Rank;
use Praxigento\Bonus\Loyalty\Lib\Entity\Cfg\Param;
use Praxigento\Bonus\Loyalty\Lib\Entity\Qualification;
use Praxigento\Bonus\Loyalty\Lib\Service\Calc\Request\Bonus as LoyaltyCalcBonusRequest;
use Praxigento\Bonus\Loyalty\Lib\Service\Calc\Request\Compress as LoyaltyCalcCompressRequest;
use Praxigento\Bonus\Loyalty\Lib\Service\Calc\Request\Qualification as LoyaltyCalcQualificationRequest;
use Praxigento\BonusLoyalty\Config as Cfg;

use Praxigento\Core\Test\BaseIntegrationTest;
use Praxigento\Pv\Data\Entity\Sale as PvSale;
use Praxigento\Pv\Lib\Service\Sale\Request\AccountPv as PvSaleAccountPvRequest;

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

class Main_IntegrationTest extends BaseIntegrationTest
{
    const DS_DOWNLINE_SNAP_UP_TO = '20160201';
    const DS_ORDERS_CREATED = '20160115';
    const DS_PERIOD_BEGIN = '20160101';
    const RANK_BY_GV = 'QUALIFIED_BY_PV_GV';
    const RANK_BY_PSAA = 'QUALIFIED_BY_PV_GV_PSAA';
    const RANK_BY_PV = 'QUALIFIED_BY_PV';
    /**
     * Hardcoded data for orders: [$custNdx => $pv, ...]
     * @var array
     */
    private $DEF_ORDERS = [
        1 => 5000,
        2 => 500,
        3 => 5000,
        4 => 120,
        5 => 200,
        6 => 200,
        7 => null,
        8 => 200,
        9 => 200,
        10 => null,
        11 => 200,
        12 => 120,
        13 => 100
    ];
    /** @var \Praxigento\Bonus\Loyalty\Lib\Service\ICalc */
    private $_callLoyaltyCalc;
    /** @var  \Praxigento\Pv\Lib\Service\ISale */
    private $_callPvSale;
    /** @var   \Praxigento\Accounting\Repo\IModule */
    private $_repoAcc;
    /** @var \Praxigento\Bonus\Base\Lib\Repo\IModule */
    private $_repoBase;
    /** @var \Praxigento\Core\Repo\IGeneric */
    private $repoCore;

    public function __construct()
    {
        parent::__construct();
        $this->_callPvSale = $this->_manObj->get(\Praxigento\Pv\Lib\Service\ISale::class);
        $this->_callLoyaltyCalc = $this->_manObj->get(\Praxigento\Bonus\Loyalty\Lib\Service\ICalc::class);
        $this->repoCore = $this->_manObj->get(\Praxigento\Core\Repo\IGeneric::class);
        $this->_repoBase = $this->_manObj->get(\Praxigento\Bonus\Base\Lib\Repo\IModule::class);
        $this->_repoAcc = $this->_manObj->get(\Praxigento\Accounting\Repo\IModule::class);
    }

    private function _calcBonus()
    {
        $req = new LoyaltyCalcBonusRequest();
        $resp = $this->_callLoyaltyCalc->bonus($req);
        $this->assertTrue($resp->isSucceed());
        $calcId = $resp->getCalcId();<commit_msg>MOBI-280 - Unit tests and code coverage after grids (PV module)<commit_after><?php
/**
 * User: <NAME> <<EMAIL>>
 */
namespace Praxigento\Bonus\Loyalty\Lib\Test\Story01;

use Praxigento\Accounting\Data\Entity\Account;
use Praxigento\Bonus\Base\Lib\Entity\Calculation;
use Praxigento\Bonus\Base\Lib\Entity\Cfg\Generation;
use Praxigento\Bonus\Base\Lib\Entity\Compress;
use Praxigento\Bonus\Base\Lib\Entity\Rank;
use Praxigento\Bonus\Loyalty\Lib\Entity\Cfg\Param;
use Praxigento\Bonus\Loyalty\Lib\Entity\Qualification;
use Praxigento\Bonus\Loyalty\Lib\Service\Calc\Request\Bonus as LoyaltyCalcBonusRequest;
use Praxigento\Bonus\Loyalty\Lib\Service\Calc\Request\Compress as LoyaltyCalcCompressRequest;
use Praxigento\Bonus\Loyalty\Lib\Service\Calc\Request\Qualification as LoyaltyCalcQualificationRequest;
use Praxigento\BonusLoyalty\Config as Cfg;

use Praxigento\Core\Test\BaseIntegrationTest;
use Praxigento\Pv\Data\Entity\Sale as PvSale;
use Praxigento\Pv\Service\Sale\Request\AccountPv as PvSaleAccountPvRequest;

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

class Main_IntegrationTest extends BaseIntegrationTest
{
    const DS_DOWNLINE_SNAP_UP_TO = '20160201';
    const DS_ORDERS_CREATED = '20160115';
    const DS_PERIOD_BEGIN = '20160101';
    const RANK_BY_GV = 'QUALIFIED_BY_PV_GV';
    const RANK_BY_PSAA = 'QUALIFIED_BY_PV_GV_PSAA';
    const RANK_BY_PV = 'QUALIFIED_BY_PV';
    /**
     * Hardcoded data for orders: [$custNdx => $pv, ...]
     * @var array
     */
    private $DEF_ORDERS = [
        1 => 5000,
        2 => 500,
        3 => 5000,
        4 => 120,
        5 => 200,
        6 => 200,
        7 => null,
        8 => 200,
        9 => 200,
        10 => null,
        11 => 200,
        12 => 120,
        13 => 100
    ];
    /** @var \Praxigento\Bonus\Loyalty\Lib\Service\ICalc */
    private $_callLoyaltyCalc;
    /** @var  \Praxigento\Pv\Service\ISale */
    private $_callPvSale;
    /** @var   \Praxigento\Accounting\Repo\IModule */
    private $_repoAcc;
    /** @var \Praxigento\Bonus\Base\Lib\Repo\IModule */
    private $_repoBase;
    /** @var \Praxigento\Core\Repo\IGeneric */
    private $repoCore;

    public function __construct()
    {
        parent::__construct();
        $this->_callPvSale = $this->_manObj->get(\Praxigento\Pv\Service\ISale::class);
        $this->_callLoyaltyCalc = $this->_manObj->get(\Praxigento\Bonus\Loyalty\Lib\Service\ICalc::class);
        $this->repoCore = $this->_manObj->get(\Praxigento\Core\Repo\IGeneric::class);
        $this->_repoBase = $this->_manObj->get(\Praxigento\Bonus\Base\Lib\Repo\IModule::class);
        $this->_repoAcc = $this->_manObj->get(\Praxigento\Accounting\Repo\IModule::class);
    }

    private function _calcBonus()
    {
        $req = new LoyaltyCalcBonusRequest();
        $resp = $this->_callLoyaltyCalc->bonus($req);
        $this->assertTrue($resp->isSucceed());
        $calcId = $resp->getCalcId();
{'fraction_non_alphanumeric': 0.1431277988287978, 'fraction_numerical': 0.027385463313813297, 'mean_word_length': 3.2386861313868613, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 77, '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': '6187163', 'n_tokens_mistral': 2316, 'n_tokens_neox': 2162, 'n_words': 310}