#StackBounty: #magento2 #controllers #unit-tests #framework Class 'MagentoTestFrameworkTestCaseAbstractController' not found…

Bounty: 100

I tried to make a unit test for my custom module like this:

app/code/MyCompany/UnitTest/Test/Unit/Controller/SpinTest.php

namespace MyCompanyUnitTestController;

class SpinTest extends MagentoTestFrameworkTestCaseAbstractController
{
    public function testLogin()
    {
        $params = [
          'customer_id' => '3'
        ];
        $this->getRequest()->setPostValue($params);
        $this->dispatch('spin/run');
        $result = $this->getResponse()->getBody();
        $this->assertEquals('200', $result['status']);
    }
}

and ran the unit from terminal:

vendor/phpunit/phpunit/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/MyCompany/UnitTest/Test/Unit/Controller/

but i got an error like this:

Class ‘MagentoTestFrameworkTestCaseAbstractController’ not found in
/var/www/mage2/app/code/MyCompany/UnitTest/Test/Unit/Controller/SpinTest.php
on line 4


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.