SimpleWithDataProviderArrayCest.php 598 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. class SimpleWithDataProviderArrayCest
  3. {
  4. /**
  5. * @dataProvider getTestData
  6. *
  7. * @example ["fizz", "buzz"]
  8. * @example [null, "test"]
  9. */
  10. public function helloWorld(\CodeGuy $I, \Codeception\Example $example) {
  11. $I->execute(function($example) {
  12. if (!is_array($example)) {
  13. return false;
  14. }
  15. return count($example);
  16. })->seeResultEquals(2);
  17. }
  18. protected function getTestData()
  19. {
  20. return [
  21. ['foo', 'bar'],
  22. [1, 2],
  23. [true, false],
  24. ];
  25. }
  26. }