fooman / magento2-phpunit-bridge
Installs: 6 745
Dependents: 4
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0
- magento/framework: ^101.0 || ^102.0 || ^103.0
- phpunit/phpunit: ^6.2 || ^9.1
README
The aim is to be able to write phpunit tests for phpunit 9 and then be able to run these for Magento 2.4 and Magento 2.3 and 2.2 (more accurately their associated magento/framework versions and phpunit versions). Earlier versions bridged between phpunit 4 and 6.
Install with
composer require fooman/magento2-phpunit-bridge --dev
and then have your tests extend \Fooman\PhpunitBridge\BaseUnitTestCase
:
<?php
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
class MyClassToTest extends \Fooman\PhpunitBridge\BaseUnitTestCase
{
public function setUp(): void
{
$objectManager = new ObjectManager($this);
}
public function testFunctionality()
{
$mock = $this->createMock(\Vendor\Module\MyClass::class);
}
}
this will now work on Magento 2.3 as well without failures related to not using \PHPUnit_Framework_TestCase.