DatabaseAbstractSchemaGrammarTest.php 990 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Illuminate\Tests\Database;
  3. use Illuminate\Database\Connection;
  4. use Illuminate\Database\Schema\Grammars\Grammar;
  5. use LogicException;
  6. use Mockery as m;
  7. use PHPUnit\Framework\TestCase;
  8. class DatabaseAbstractSchemaGrammarTest extends TestCase
  9. {
  10. protected function tearDown(): void
  11. {
  12. m::close();
  13. }
  14. public function testCreateDatabase()
  15. {
  16. $grammar = new class extends Grammar {};
  17. $this->expectException(LogicException::class);
  18. $this->expectExceptionMessage('This database driver does not support creating databases.');
  19. $grammar->compileCreateDatabase('foo', m::mock(Connection::class));
  20. }
  21. public function testDropDatabaseIfExists()
  22. {
  23. $grammar = new class extends Grammar {};
  24. $this->expectException(LogicException::class);
  25. $this->expectExceptionMessage('This database driver does not support dropping databases.');
  26. $grammar->compileDropDatabaseIfExists('foo');
  27. }
  28. }