php-image-converter icon indicating copy to clipboard operation
php-image-converter copied to clipboard

Better tests

Open jenstornell opened this issue 6 years ago • 2 comments

jenstornell avatar Apr 27 '19 04:04 jenstornell

@peter279k has added PHPUnit tests. That's almost standard nowdays, so it's a good approach. Thanks for that!

  • It looks like the current tests are not fully correct. pngToAvailablImagesProvider and jpgToAvailablImagesProvider does the same thing.

https://github.com/jenstornell/php-image-converter/blob/master/tests/ImageConverterTest.php

More tests needed

  • [ ] Every format read from (about 4-5 formats)
  • [ ] Every format save to (about 4-5 formats)
  • [ ] Test with and without the quality argument (output file size should differ)
  • [ ] Test to send the quality argument to an image type that does not support it (should be ignored)
  • [ ] Test unknown path (should throw error)
  • [ ] Test unkown extension (both from and to)
  • [ ] Test file permissions on save (should throw error on could not write file)
  • [ ] Test file with correct filename but with wrong mimetype (should throw error)

jenstornell avatar Apr 30 '19 05:04 jenstornell

@jenstornell, thank you for your concern.

You're right, the data provider is duplicated and I think we can use the one availableImageProvider to collect the image file path for the test cases :).

peter279k avatar Apr 30 '19 06:04 peter279k