Laravel UnitTest course - PHPUnit vs Pest, quick comparison
I wanted to make a quick comparison between what would be php unit which is the file you are seeing here and pes what it refers to and the practice directly, that is to say how the tests are formed and what changes what changes here is that here we use classes and here we use these Test methods today as is you can see for the rest that is the important part what is the test itself is practically the same of course, that some assertion methods change for example here we can use the one to do match regular expression which is for the part of the tests I say from pes and here we have another That is the equivalent that I found but surely you can find another one that would be to do assertStringContainsString() then one evaluated it with the regular tests the regular expressions and another evaluates it directly with a Stream for the rest it is basically the same here what changes is the header in which in pest, this is from pest Remember that it is from pes I place it here as part of the request here you can see it and here I place it with the method called withHeaders for the rest as I told you it is exactly the same Right here you can see the comparison between this test and this other one that we have here which is the same as you can see here I also cleaned up the syntax for pes a little bit in which in this case it would not be necessary to handle the response afterwards and here I have it like this but I could also leave it in this form and here I delete this and therefore you can see that they are exactly the same. So there are practically no differences between pest and php unit.
- Andrés Cruz
Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter