Open siju-corra opened 6 years ago
Thank you very much for the topic suggestion!
I really enjoy TDD in Magento 2. In fact, in 2016 I recorded a bunch of videos and put them on YouTube at https://www.youtube.com/mage2katas
Since then Magento has updated the PHPUnit version, so the syntax for using PHPUnit has changed a little, but the approaches and how to use the integration testing framework is still totally valid.
The main changes in regards to PHPUnit are that tests now extend from \PHPUnit\Framework\TestCase
instead of PHPUnit_Framework_TestCase
.
Also, instead of $this->getMock($class, [], [], '', false)
to create a test double instance with a null constructor, the new method $this->createMock($class)
must be used.
If any arguments are required for the test double, $this->getMockBuilder()->...
has to be used as before.
And finally, the PHP methods to expect expectations changed. Exception expectations with annotations still work the same.
So, since there are only superficial changes, I think the topic already is fairly well covered. There are quite a few other topics I want to cover first before covering TDD and testing in Mage2 TV.
If this topic gets a lot of thumbs up here I will be happy to prioritize it.
Thanks Vinai for the quick response. I have already been following your Mage2katas channel and found they are mostly integration testing. All the topics you are posting in the mage2.tv are useful. I will look forward to get more thumbs up for this topic too 👍 Thanks
It would be great if you can dedicate few chapters for writing basic PHPUnit testing in Magento 2 and especially the TDD in Magento 2 way.