Create a PHPUnit Test in Magento 2

Az Codez
2 min readOct 24, 2021

In your module create a Test folder and add a unit test file

app\code\AzCodez\MagentoTraining\Test\Unit\TestUnitTest.php

Add code to your test class

<?phpuse PHPUnit\Framework\TestCase;class TestUnitTest extends TestCase
{
public function testFirstUnitTest()
{
//Arrange
//Asset //Act
$this->assertEquals(1,1);
}
}
  • In command line go to your root of…

--

--

Az Codez

Cloud Software Engineer focusing on PHP, Python, JS, CI/CD, GitOps, AWS, Azure, Adobe Commerce. I enjoy code for good projects, tech, gym, nature & travel