Grunt JavaScript QUnit Testing
Writing testable JavaScript code is in my eyes sometimes more complex as writing testable code in other programming
languages. JavaScript has it roots in the web development and the normal environment for JavaScript code was the
web browser. There was always the global document
object.
Node.js has changed this assumption.
Sometimes it is necessary to compare a generated PDF file with a given one in PHP. Just to check with one PHPUnit test that your PDF generation works the expected way. But pretty often generated PDF files are equal, but there content isn't the same. For example if you use FPDF the following assertion can fail if the files have different meta data.
$pdfContent1 = file_get_contents('path_to_pdf1');
$pdfContent2 = file_get_contents('path_to_pdf2');
$this->assertSame($pdfContent1, $pdfContent2);
Lesti_Fpc has changed in the last month. Some of the changes are part of the code quality. Today I would like to present the tools, that I use to raise the quality of my Magento extension.
I made a small plugin for jQuery to get the color of an image pixel. It's called broilerjs. I wanted to test the plugin via QUnit, a JavaScript Unit Testing framework. But I could not find a possibility to simulate a mouse click on special x and y coordinates. But in the end it was very easy.
Using GitLab Continuous Integration is pretty cool for testing. You just need to edit the build script under Build settings and can run your tests. For example PHPUnit tests. Your tests will run and you will see if you get a success or a fail. All fine.