HasTest.php 716 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Medoo\Tests;
  3. /**
  4. * @coversDefaultClass \Medoo\Medoo
  5. */
  6. class HasTest extends MedooTestCase
  7. {
  8. /**
  9. * @covers ::has()
  10. * @covers ::selectContext()
  11. * @dataProvider typesProvider
  12. */
  13. public function testHas($type)
  14. {
  15. $this->setType($type);
  16. $this->database->has("account", [
  17. "user_name" => "foo"
  18. ]);
  19. $this->assertQuery([
  20. 'default' => <<<EOD
  21. SELECT EXISTS(SELECT 1 FROM "account" WHERE "user_name" = 'foo')
  22. EOD,
  23. 'mssql' => <<<EOD
  24. SELECT TOP 1 1 FROM [account] WHERE [user_name] = 'foo'
  25. EOD
  26. ], $this->database->queryString);
  27. }
  28. }