RawTest.php 674 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Medoo\Tests;
  3. use Medoo\Medoo;
  4. /**
  5. * @coversDefaultClass \Medoo\Medoo
  6. */
  7. class RawTest extends MedooTestCase
  8. {
  9. /**
  10. * @covers ::raw()
  11. * @covers ::isRaw()
  12. * @covers ::buildRaw()
  13. * @dataProvider typesProvider
  14. */
  15. public function testRawWithPlaceholder($type)
  16. {
  17. $this->setType($type);
  18. $this->database->select('account', [
  19. 'score' => Medoo::raw('SUM(<age> + <experience>)')
  20. ]);
  21. $this->assertQuery(
  22. <<<EOD
  23. SELECT SUM("age" + "experience") AS "score"
  24. FROM "account"
  25. EOD,
  26. $this->database->queryString
  27. );
  28. }
  29. }