MigrationTest.php 1018 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Doctrine\DBAL\Migrations\Tests;
  3. use Doctrine\DBAL\Migrations\Configuration\Configuration;
  4. use Doctrine\DBAL\Migrations\Migration;
  5. class MigrationTest extends MigrationTestCase
  6. {
  7. private $config;
  8. public function setUp()
  9. {
  10. $this->config = new Configuration($this->getSqliteConnection());
  11. $this->config->setMigrationsDirectory(\sys_get_temp_dir());
  12. $this->config->setMigrationsNamespace('DoctrineMigrations\\');
  13. }
  14. public function testMigrateToUnknownVersionThrowsException()
  15. {
  16. $migration = new Migration($this->config);
  17. $this->setExpectedException('Doctrine\DBAL\Migrations\MigrationException', 'Could not find migration version 1234');
  18. $migration->migrate('1234');
  19. }
  20. /**
  21. * @expectedException Doctrine\DBAL\Migrations\MigrationException
  22. */
  23. public function testMigrateWithNoMigrationsThrowsException()
  24. {
  25. $migration = new Migration($this->config);
  26. $sql = $migration->migrate();
  27. }
  28. }