I'm working on some Codeception acceptance tests, and one thing that I want to check is whether or not my application's e-mails are being sent with the correct text.
In order to do that, I'm comparing the actually sent text with a txt dump of what the text should actually be. I'm loading the txt dump with file_get_contents
. Unfortunately the text contains a copyright symbol (©) which file_get_contents loads as ┬⌐ due to encoding issues. That means I'll need to take a few extra steps any time I load those files with UTF-8 characters.
A solution that I liked was @Gordon's suggestion of a file_get_contents_utf8 function.
What's the best way to make that function available to all of my tests?
Make it a helper method.
codecept generate:helper Utf8
tests/_support/Helper/Utf8.php
modules:
enabled:
- \Helper\Utf8
Documentation: http://codeception.com/docs/06-ModulesAndHelpers#Helpers