1
0
Fork 0
mirror of synced 2025-04-04 05:33:31 +03:00

update testings

This commit is contained in:
Akolzin Dmitry 2020-04-08 16:07:55 +03:00 committed by gorokh
parent 2a69456087
commit 2cff1e1a1e
12 changed files with 63 additions and 47 deletions

3
.gitignore vendored
View file

@ -1 +1,2 @@
/nbproject/private/
/nbproject/private/
.idea

View file

@ -15,7 +15,23 @@ magento_clone() {
git clone https://github.com/magento/magento2
cd magento2
git checkout $BRANCH
composer update
touch auth.json
echo '
{
"http-basic": {
"repo.magento.com": {
"username": "<public-key>",
"password": "<private-key>"
}
}
}
' > auth.json
sudo sed -e "s?<public-key>?$PUBLIC_KEY?g" --in-place auth.json
sudo sed -e "s?<private-key>?$PRIVATE_KEY?g" --in-place auth.json
composer install --no-interaction --prefer-dist
composer require retailcrm/api-client-php
}

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Helpers;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class FieldsetTest extends \PHPUnit\Framework\TestCase
class FieldsetTest extends TestCase
{
protected $elementMock;
protected $authSessionMock;

26
src/Test/TestCase.php Normal file
View file

@ -0,0 +1,26 @@
<?php
namespace Retailcrm\Retailcrm\Test;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
protected function createMock($originalClassName)
{
if (method_exists(\PHPUnit\Framework\TestCase::class, 'createMock')) {
return parent::createMock($originalClassName);
} elseif (method_exists(\PHPUnit\Framework\TestCase::class, 'getMock')) {
return $this->getMockBuilder($originalClassName)
->disableOriginalConstructor()
->disableOriginalClone()
->disableArgumentCloning()
->getMock();
} else {
throw new \RuntimeException('Not supported phpunit version');
}
}
}

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Block\Frontend;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class DaemonCollectorTest extends \PHPUnit\Framework\TestCase
class DaemonCollectorTest extends TestCase
{
private $unit;
private $customer;

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Model\Observer;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class CustomerTest extends \PHPUnit\Framework\TestCase
class CustomerTest extends TestCase
{
private $mockApi;
private $mockResponse;

View file

@ -2,15 +2,12 @@
namespace Retailcrm\Retailcrm\Test\Unit\Observer;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
/**
* Order create observer test class
*/
class OrderCreateTest extends \PHPUnit\Framework\TestCase
class OrderCreateTest extends TestCase
{
private $unit;
private $mockEvent;

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Observer;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class OrderUpdateTest extends \PHPUnit\Framework\TestCase
class OrderUpdateTest extends TestCase
{
private $unit;
private $objectManager;

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Model\Service;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class CustomerTest extends \PHPUnit\Framework\TestCase
class CustomerTest extends TestCase
{
private $mockData;
private $mockCustomer;

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Model\Service;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class IntegrationModuleTest extends \PHPUnit\Framework\TestCase
class IntegrationModuleTest extends TestCase
{
private $mockResourceConfig;
private $mockApiClient;

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Model\Service;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class InventoriesUploadTest extends \PHPUnit\Framework\TestCase
class InventoriesUploadTest extends TestCase
{
private $mockApi;
private $mockProductRepository;

View file

@ -2,12 +2,9 @@
namespace Retailcrm\Retailcrm\Test\Unit\Model\Service;
// backward compatibility with phpunit < v.6
if (!class_exists('\PHPUnit\Framework\TestCase') && class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
use Retailcrm\Retailcrm\Test\TestCase;
class OrderTest extends \PHPUnit\Framework\TestCase
class OrderTest extends TestCase
{
private $mockProductRepository;
private $mockHelper;