QRStringTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Class QRStringTest
  4. *
  5. * @filesource QRStringTest.php
  6. * @created 24.12.2017
  7. * @package chillerlan\QRCodeTest\Output
  8. * @author Smiley <smiley@chillerlan.net>
  9. * @copyright 2017 Smiley
  10. * @license MIT
  11. */
  12. namespace chillerlan\QRCodeTest\Output;
  13. use chillerlan\QRCode\{QRCode, Output\QRString};
  14. class QRStringTest extends QROutputTestAbstract{
  15. protected $FQCN = QRString::class;
  16. public function types(){
  17. return [
  18. 'json' => [QRCode::OUTPUT_STRING_JSON],
  19. 'text' => [QRCode::OUTPUT_STRING_TEXT],
  20. ];
  21. }
  22. /**
  23. * @dataProvider types
  24. * @param $type
  25. */
  26. public function testStringOutput($type){
  27. $this->options->outputType = $type;
  28. $this->options->cachefile = $this::cachefile.$type;
  29. $this->setOutputInterface();
  30. $data = $this->outputInterface->dump();
  31. $this->assertSame($data, file_get_contents($this->options->cachefile));
  32. }
  33. public function testSetModuleValues(){
  34. $this->options->moduleValues = [
  35. // data
  36. 1024 => 'A',
  37. 4 => 'B',
  38. ];
  39. $this->setOutputInterface();
  40. $data = $this->outputInterface->dump();
  41. $this->assertStringContainsString('A', $data);
  42. $this->assertStringContainsString('B', $data);
  43. }
  44. }