0

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?

Community
  • 1
  • 1
Pete
  • 7,289
  • 10
  • 39
  • 63

1 Answers1

4

Make it a helper method.

  1. Create new helper: codecept generate:helper Utf8
  2. Add your method to tests/_support/Helper/Utf8.php
  3. Enable helper in each suite: modules: enabled: - \Helper\Utf8

Documentation: http://codeception.com/docs/06-ModulesAndHelpers#Helpers

Naktibalda
  • 13,705
  • 5
  • 35
  • 51