public function test_aroundGetReport() { /** === Test Data === */ $REQUEST_NAME = \Praxigento\Core\Config::DS_CUSTOMERS_GRID; /** === Setup Mocks === */ $mResult = $this->_mock(\Magento\Customer\Model\ResourceModel\Grid\Collection::class); $mProceed = function () use($mResult) { return $mResult; }; // $this->_subQueryModifier->populateSelect($result); $this->mSubQueryModifier->shouldReceive('populateSelect')->once(); // $this->_subQueryModifier->addFieldsMapping($result); $this->mSubQueryModifier->shouldReceive('addFieldsMapping')->once(); /** === Call and asserts === */ $res = $this->obj->aroundGetReport($this->mSubject, $mProceed, $REQUEST_NAME); $this->assertTrue($res instanceof \Magento\Customer\Model\ResourceModel\Grid\Collection); }
public function test_aroundGetReport() { /** === Test Data === */ $REQUEST_NAME = \Praxigento\Core\Config::DS_SALES_ORDERS_GRID; $RESULT = $this->_mock(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection::class); /** === Setup Mocks === */ $mProceed = function ($dataIn) use($REQUEST_NAME, $RESULT) { $this->assertEquals($REQUEST_NAME, $dataIn); return $RESULT; }; // $this->_subQueryModifier->populateSelect($result); $this->mSubQueryModifier->shouldReceive('populateSelect')->once()->with($RESULT); // $this->_subQueryModifier->addFieldsMapping($result); $this->mSubQueryModifier->shouldReceive('addFieldsMapping')->once()->with($RESULT); /** === Call and asserts === */ $res = $this->obj->aroundGetReport($this->mSubject, $mProceed, $REQUEST_NAME); $this->assertEquals($RESULT, $res); }