MigrationsTest.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. <?php
  2. /**
  3. * Copyright (c) 2016 Thomas Müller <thomas.mueller@tmit.eu>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test\DB;
  9. use Doctrine\DBAL\Platforms\OraclePlatform;
  10. use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
  11. use Doctrine\DBAL\Schema\Column;
  12. use Doctrine\DBAL\Schema\ForeignKeyConstraint;
  13. use Doctrine\DBAL\Schema\Index;
  14. use Doctrine\DBAL\Schema\Schema;
  15. use Doctrine\DBAL\Schema\SchemaException;
  16. use Doctrine\DBAL\Schema\Sequence;
  17. use Doctrine\DBAL\Schema\Table;
  18. use OC\DB\Connection;
  19. use OC\DB\MigrationService;
  20. use OC\DB\SchemaWrapper;
  21. use OCP\IDBConnection;
  22. use OCP\Migration\IMigrationStep;
  23. /**
  24. * Class MigrationsTest
  25. *
  26. * @package Test\DB
  27. */
  28. class MigrationsTest extends \Test\TestCase {
  29. /** @var MigrationService | \PHPUnit\Framework\MockObject\MockObject */
  30. private $migrationService;
  31. /** @var \PHPUnit\Framework\MockObject\MockObject | IDBConnection $db */
  32. private $db;
  33. protected function setUp(): void {
  34. parent::setUp();
  35. $this->db = $this->createMock(Connection::class);
  36. $this->db->expects($this->any())->method('getPrefix')->willReturn('test_oc_');
  37. $this->migrationService = new MigrationService('testing', $this->db);
  38. }
  39. public function testGetters() {
  40. $this->assertEquals('testing', $this->migrationService->getApp());
  41. $this->assertEquals(\OC::$SERVERROOT . '/apps/testing/lib/Migration', $this->migrationService->getMigrationsDirectory());
  42. $this->assertEquals('OCA\Testing\Migration', $this->migrationService->getMigrationsNamespace());
  43. $this->assertEquals('test_oc_migrations', $this->migrationService->getMigrationsTableName());
  44. }
  45. public function testCore() {
  46. $this->migrationService = new MigrationService('core', $this->db);
  47. $this->assertEquals('core', $this->migrationService->getApp());
  48. $this->assertEquals(\OC::$SERVERROOT . '/core/Migrations', $this->migrationService->getMigrationsDirectory());
  49. $this->assertEquals('OC\Core\Migrations', $this->migrationService->getMigrationsNamespace());
  50. $this->assertEquals('test_oc_migrations', $this->migrationService->getMigrationsTableName());
  51. }
  52. public function testExecuteUnknownStep() {
  53. $this->expectException(\InvalidArgumentException::class);
  54. $this->expectExceptionMessage('Version 20170130180000 is unknown.');
  55. $this->migrationService->executeStep('20170130180000');
  56. }
  57. public function testUnknownApp() {
  58. $this->expectException(\Exception::class);
  59. $this->expectExceptionMessage('App not found');
  60. $migrationService = new MigrationService('unknown-bloody-app', $this->db);
  61. }
  62. public function testExecuteStepWithUnknownClass() {
  63. $this->expectException(\Exception::class);
  64. $this->expectExceptionMessage('Migration step \'X\' is unknown');
  65. $this->migrationService = $this->getMockBuilder(MigrationService::class)
  66. ->setMethods(['findMigrations'])
  67. ->setConstructorArgs(['testing', $this->db])
  68. ->getMock();
  69. $this->migrationService->expects($this->any())->method('findMigrations')->willReturn(
  70. ['20170130180000' => 'X', '20170130180001' => 'Y', '20170130180002' => 'Z', '20170130180003' => 'A']
  71. );
  72. $this->migrationService->executeStep('20170130180000');
  73. }
  74. public function testExecuteStepWithSchemaChange() {
  75. $schema = $this->createMock(Schema::class);
  76. $this->db->expects($this->any())
  77. ->method('createSchema')
  78. ->willReturn($schema);
  79. $this->db->expects($this->once())
  80. ->method('migrateToSchema');
  81. $wrappedSchema = $this->createMock(Schema::class);
  82. $wrappedSchema->expects($this->once())
  83. ->method('getTables')
  84. ->willReturn([]);
  85. $wrappedSchema->expects($this->once())
  86. ->method('getSequences')
  87. ->willReturn([]);
  88. $schemaResult = $this->createMock(SchemaWrapper::class);
  89. $schemaResult->expects($this->once())
  90. ->method('getWrappedSchema')
  91. ->willReturn($wrappedSchema);
  92. $step = $this->createMock(IMigrationStep::class);
  93. $step->expects($this->at(0))
  94. ->method('preSchemaChange');
  95. $step->expects($this->at(1))
  96. ->method('changeSchema')
  97. ->willReturn($schemaResult);
  98. $step->expects($this->at(2))
  99. ->method('postSchemaChange');
  100. $this->migrationService = $this->getMockBuilder(MigrationService::class)
  101. ->setMethods(['createInstance'])
  102. ->setConstructorArgs(['testing', $this->db])
  103. ->getMock();
  104. $this->migrationService->expects($this->any())
  105. ->method('createInstance')
  106. ->with('20170130180000')
  107. ->willReturn($step);
  108. $this->migrationService->executeStep('20170130180000');
  109. }
  110. public function testExecuteStepWithoutSchemaChange() {
  111. $schema = $this->createMock(Schema::class);
  112. $this->db->expects($this->any())
  113. ->method('createSchema')
  114. ->willReturn($schema);
  115. $this->db->expects($this->never())
  116. ->method('migrateToSchema');
  117. $step = $this->createMock(IMigrationStep::class);
  118. $step->expects($this->at(0))
  119. ->method('preSchemaChange');
  120. $step->expects($this->at(1))
  121. ->method('changeSchema')
  122. ->willReturn(null);
  123. $step->expects($this->at(2))
  124. ->method('postSchemaChange');
  125. $this->migrationService = $this->getMockBuilder(MigrationService::class)
  126. ->setMethods(['createInstance'])
  127. ->setConstructorArgs(['testing', $this->db])
  128. ->getMock();
  129. $this->migrationService->expects($this->any())
  130. ->method('createInstance')
  131. ->with('20170130180000')
  132. ->willReturn($step);
  133. $this->migrationService->executeStep('20170130180000');
  134. }
  135. public function dataGetMigration() {
  136. return [
  137. ['current', '20170130180001'],
  138. ['prev', '20170130180000'],
  139. ['next', '20170130180002'],
  140. ['latest', '20170130180003'],
  141. ];
  142. }
  143. /**
  144. * @dataProvider dataGetMigration
  145. * @param string $alias
  146. * @param string $expected
  147. */
  148. public function testGetMigration($alias, $expected) {
  149. $this->migrationService = $this->getMockBuilder(MigrationService::class)
  150. ->setMethods(['getMigratedVersions', 'findMigrations'])
  151. ->setConstructorArgs(['testing', $this->db])
  152. ->getMock();
  153. $this->migrationService->expects($this->any())->method('getMigratedVersions')->willReturn(
  154. ['20170130180000', '20170130180001']
  155. );
  156. $this->migrationService->expects($this->any())->method('findMigrations')->willReturn(
  157. ['20170130180000' => 'X', '20170130180001' => 'Y', '20170130180002' => 'Z', '20170130180003' => 'A']
  158. );
  159. $this->assertEquals(
  160. ['20170130180000', '20170130180001', '20170130180002', '20170130180003'],
  161. $this->migrationService->getAvailableVersions());
  162. $migration = $this->migrationService->getMigration($alias);
  163. $this->assertEquals($expected, $migration);
  164. }
  165. public function testMigrate() {
  166. $this->migrationService = $this->getMockBuilder(MigrationService::class)
  167. ->setMethods(['getMigratedVersions', 'findMigrations', 'executeStep'])
  168. ->setConstructorArgs(['testing', $this->db])
  169. ->getMock();
  170. $this->migrationService->expects($this->any())->method('getMigratedVersions')->willReturn(
  171. ['20170130180000', '20170130180001']
  172. );
  173. $this->migrationService->expects($this->any())->method('findMigrations')->willReturn(
  174. ['20170130180000' => 'X', '20170130180001' => 'Y', '20170130180002' => 'Z', '20170130180003' => 'A']
  175. );
  176. $this->assertEquals(
  177. ['20170130180000', '20170130180001', '20170130180002', '20170130180003'],
  178. $this->migrationService->getAvailableVersions());
  179. $this->migrationService->expects($this->exactly(2))->method('executeStep')
  180. ->withConsecutive(['20170130180002'], ['20170130180003']);
  181. $this->migrationService->migrate();
  182. }
  183. public function testEnsureOracleIdentifierLengthLimitValid() {
  184. $column = $this->createMock(Column::class);
  185. $column->expects($this->once())
  186. ->method('getName')
  187. ->willReturn(\str_repeat('a', 30));
  188. $index = $this->createMock(Index::class);
  189. $index->expects($this->once())
  190. ->method('getName')
  191. ->willReturn(\str_repeat('a', 30));
  192. $foreignKey = $this->createMock(ForeignKeyConstraint::class);
  193. $foreignKey->expects($this->once())
  194. ->method('getName')
  195. ->willReturn(\str_repeat('a', 30));
  196. $table = $this->createMock(Table::class);
  197. $table->expects($this->atLeastOnce())
  198. ->method('getName')
  199. ->willReturn(\str_repeat('a', 30));
  200. $sequence = $this->createMock(Sequence::class);
  201. $sequence->expects($this->atLeastOnce())
  202. ->method('getName')
  203. ->willReturn(\str_repeat('a', 30));
  204. $table->expects($this->once())
  205. ->method('getColumns')
  206. ->willReturn([$column]);
  207. $table->expects($this->once())
  208. ->method('getIndexes')
  209. ->willReturn([$index]);
  210. $table->expects($this->once())
  211. ->method('getForeignKeys')
  212. ->willReturn([$foreignKey]);
  213. $table->expects($this->once())
  214. ->method('getPrimaryKey')
  215. ->willReturn(null);
  216. $schema = $this->createMock(Schema::class);
  217. $schema->expects($this->once())
  218. ->method('getTables')
  219. ->willReturn([$table]);
  220. $schema->expects($this->once())
  221. ->method('getSequences')
  222. ->willReturn([$sequence]);
  223. $sourceSchema = $this->createMock(Schema::class);
  224. $sourceSchema->expects($this->any())
  225. ->method('getTable')
  226. ->willThrowException(new SchemaException());
  227. $sourceSchema->expects($this->any())
  228. ->method('hasSequence')
  229. ->willReturn(false);
  230. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  231. }
  232. public function testEnsureOracleIdentifierLengthLimitValidWithPrimaryKey() {
  233. $index = $this->createMock(Index::class);
  234. $index->expects($this->any())
  235. ->method('getName')
  236. ->willReturn(\str_repeat('a', 30));
  237. $table = $this->createMock(Table::class);
  238. $table->expects($this->any())
  239. ->method('getName')
  240. ->willReturn(\str_repeat('a', 26));
  241. $table->expects($this->once())
  242. ->method('getColumns')
  243. ->willReturn([]);
  244. $table->expects($this->once())
  245. ->method('getIndexes')
  246. ->willReturn([]);
  247. $table->expects($this->once())
  248. ->method('getForeignKeys')
  249. ->willReturn([]);
  250. $table->expects($this->once())
  251. ->method('getPrimaryKey')
  252. ->willReturn($index);
  253. $schema = $this->createMock(Schema::class);
  254. $schema->expects($this->once())
  255. ->method('getTables')
  256. ->willReturn([$table]);
  257. $schema->expects($this->once())
  258. ->method('getSequences')
  259. ->willReturn([]);
  260. $sourceSchema = $this->createMock(Schema::class);
  261. $sourceSchema->expects($this->any())
  262. ->method('getTable')
  263. ->willThrowException(new SchemaException());
  264. $sourceSchema->expects($this->any())
  265. ->method('hasSequence')
  266. ->willReturn(false);
  267. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  268. }
  269. public function testEnsureOracleIdentifierLengthLimitValidWithPrimaryKeyDefault() {
  270. $defaultName = 'PRIMARY';
  271. if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) {
  272. $defaultName = \str_repeat('a', 26) . '_' . \str_repeat('b', 30) . '_seq';
  273. } elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) {
  274. $defaultName = \str_repeat('a', 26) . '_seq';
  275. }
  276. $index = $this->createMock(Index::class);
  277. $index->expects($this->any())
  278. ->method('getName')
  279. ->willReturn($defaultName);
  280. $index->expects($this->any())
  281. ->method('getColumns')
  282. ->willReturn([\str_repeat('b', 30)]);
  283. $table = $this->createMock(Table::class);
  284. $table->expects($this->any())
  285. ->method('getName')
  286. ->willReturn(\str_repeat('a', 25));
  287. $table->expects($this->once())
  288. ->method('getColumns')
  289. ->willReturn([]);
  290. $table->expects($this->once())
  291. ->method('getIndexes')
  292. ->willReturn([]);
  293. $table->expects($this->once())
  294. ->method('getForeignKeys')
  295. ->willReturn([]);
  296. $table->expects($this->once())
  297. ->method('getPrimaryKey')
  298. ->willReturn($index);
  299. $schema = $this->createMock(Schema::class);
  300. $schema->expects($this->once())
  301. ->method('getTables')
  302. ->willReturn([$table]);
  303. $schema->expects($this->once())
  304. ->method('getSequences')
  305. ->willReturn([]);
  306. $sourceSchema = $this->createMock(Schema::class);
  307. $sourceSchema->expects($this->any())
  308. ->method('getTable')
  309. ->willThrowException(new SchemaException());
  310. $sourceSchema->expects($this->any())
  311. ->method('hasSequence')
  312. ->willReturn(false);
  313. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  314. }
  315. public function testEnsureOracleIdentifierLengthLimitTooLongTableName() {
  316. $this->expectException(\InvalidArgumentException::class);
  317. $table = $this->createMock(Table::class);
  318. $table->expects($this->any())
  319. ->method('getName')
  320. ->willReturn(\str_repeat('a', 31));
  321. $schema = $this->createMock(Schema::class);
  322. $schema->expects($this->once())
  323. ->method('getTables')
  324. ->willReturn([$table]);
  325. $sourceSchema = $this->createMock(Schema::class);
  326. $sourceSchema->expects($this->any())
  327. ->method('getTable')
  328. ->willThrowException(new SchemaException());
  329. $sourceSchema->expects($this->any())
  330. ->method('hasSequence')
  331. ->willReturn(false);
  332. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  333. }
  334. public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithDefault() {
  335. $this->expectException(\InvalidArgumentException::class);
  336. $defaultName = 'PRIMARY';
  337. if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) {
  338. $defaultName = \str_repeat('a', 27) . '_' . \str_repeat('b', 30) . '_seq';
  339. } elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) {
  340. $defaultName = \str_repeat('a', 27) . '_seq';
  341. }
  342. $index = $this->createMock(Index::class);
  343. $index->expects($this->any())
  344. ->method('getName')
  345. ->willReturn($defaultName);
  346. $index->expects($this->any())
  347. ->method('getColumns')
  348. ->willReturn([\str_repeat('b', 30)]);
  349. $table = $this->createMock(Table::class);
  350. $table->expects($this->any())
  351. ->method('getName')
  352. ->willReturn(\str_repeat('a', 27));
  353. $table->expects($this->once())
  354. ->method('getColumns')
  355. ->willReturn([]);
  356. $table->expects($this->once())
  357. ->method('getIndexes')
  358. ->willReturn([]);
  359. $table->expects($this->once())
  360. ->method('getForeignKeys')
  361. ->willReturn([]);
  362. $table->expects($this->once())
  363. ->method('getPrimaryKey')
  364. ->willReturn($index);
  365. $schema = $this->createMock(Schema::class);
  366. $schema->expects($this->once())
  367. ->method('getTables')
  368. ->willReturn([$table]);
  369. $sourceSchema = $this->createMock(Schema::class);
  370. $sourceSchema->expects($this->any())
  371. ->method('getTable')
  372. ->willThrowException(new SchemaException());
  373. $sourceSchema->expects($this->any())
  374. ->method('hasSequence')
  375. ->willReturn(false);
  376. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  377. }
  378. public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithName() {
  379. $this->expectException(\InvalidArgumentException::class);
  380. $index = $this->createMock(Index::class);
  381. $index->expects($this->any())
  382. ->method('getName')
  383. ->willReturn(\str_repeat('a', 31));
  384. $table = $this->createMock(Table::class);
  385. $table->expects($this->any())
  386. ->method('getName')
  387. ->willReturn(\str_repeat('a', 26));
  388. $table->expects($this->once())
  389. ->method('getColumns')
  390. ->willReturn([]);
  391. $table->expects($this->once())
  392. ->method('getIndexes')
  393. ->willReturn([]);
  394. $table->expects($this->once())
  395. ->method('getForeignKeys')
  396. ->willReturn([]);
  397. $table->expects($this->once())
  398. ->method('getPrimaryKey')
  399. ->willReturn($index);
  400. $schema = $this->createMock(Schema::class);
  401. $schema->expects($this->once())
  402. ->method('getTables')
  403. ->willReturn([$table]);
  404. $sourceSchema = $this->createMock(Schema::class);
  405. $sourceSchema->expects($this->any())
  406. ->method('getTable')
  407. ->willThrowException(new SchemaException());
  408. $sourceSchema->expects($this->any())
  409. ->method('hasSequence')
  410. ->willReturn(false);
  411. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  412. }
  413. public function testEnsureOracleIdentifierLengthLimitTooLongColumnName() {
  414. $this->expectException(\InvalidArgumentException::class);
  415. $column = $this->createMock(Column::class);
  416. $column->expects($this->any())
  417. ->method('getName')
  418. ->willReturn(\str_repeat('a', 31));
  419. $table = $this->createMock(Table::class);
  420. $table->expects($this->any())
  421. ->method('getName')
  422. ->willReturn(\str_repeat('a', 30));
  423. $table->expects($this->once())
  424. ->method('getColumns')
  425. ->willReturn([$column]);
  426. $schema = $this->createMock(Schema::class);
  427. $schema->expects($this->once())
  428. ->method('getTables')
  429. ->willReturn([$table]);
  430. $sourceSchema = $this->createMock(Schema::class);
  431. $sourceSchema->expects($this->any())
  432. ->method('getTable')
  433. ->willThrowException(new SchemaException());
  434. $sourceSchema->expects($this->any())
  435. ->method('hasSequence')
  436. ->willReturn(false);
  437. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  438. }
  439. public function testEnsureOracleIdentifierLengthLimitTooLongIndexName() {
  440. $this->expectException(\InvalidArgumentException::class);
  441. $index = $this->createMock(Index::class);
  442. $index->expects($this->any())
  443. ->method('getName')
  444. ->willReturn(\str_repeat('a', 31));
  445. $table = $this->createMock(Table::class);
  446. $table->expects($this->any())
  447. ->method('getName')
  448. ->willReturn(\str_repeat('a', 30));
  449. $table->expects($this->once())
  450. ->method('getColumns')
  451. ->willReturn([]);
  452. $table->expects($this->once())
  453. ->method('getIndexes')
  454. ->willReturn([$index]);
  455. $schema = $this->createMock(Schema::class);
  456. $schema->expects($this->once())
  457. ->method('getTables')
  458. ->willReturn([$table]);
  459. $sourceSchema = $this->createMock(Schema::class);
  460. $sourceSchema->expects($this->any())
  461. ->method('getTable')
  462. ->willThrowException(new SchemaException());
  463. $sourceSchema->expects($this->any())
  464. ->method('hasSequence')
  465. ->willReturn(false);
  466. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  467. }
  468. public function testEnsureOracleIdentifierLengthLimitTooLongForeignKeyName() {
  469. $this->expectException(\InvalidArgumentException::class);
  470. $foreignKey = $this->createMock(ForeignKeyConstraint::class);
  471. $foreignKey->expects($this->any())
  472. ->method('getName')
  473. ->willReturn(\str_repeat('a', 31));
  474. $table = $this->createMock(Table::class);
  475. $table->expects($this->any())
  476. ->method('getName')
  477. ->willReturn(\str_repeat('a', 30));
  478. $table->expects($this->once())
  479. ->method('getColumns')
  480. ->willReturn([]);
  481. $table->expects($this->once())
  482. ->method('getIndexes')
  483. ->willReturn([]);
  484. $table->expects($this->once())
  485. ->method('getForeignKeys')
  486. ->willReturn([$foreignKey]);
  487. $schema = $this->createMock(Schema::class);
  488. $schema->expects($this->once())
  489. ->method('getTables')
  490. ->willReturn([$table]);
  491. $sourceSchema = $this->createMock(Schema::class);
  492. $sourceSchema->expects($this->any())
  493. ->method('getTable')
  494. ->willThrowException(new SchemaException());
  495. $sourceSchema->expects($this->any())
  496. ->method('hasSequence')
  497. ->willReturn(false);
  498. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  499. }
  500. public function testEnsureOracleIdentifierLengthLimitTooLongSequenceName() {
  501. $this->expectException(\InvalidArgumentException::class);
  502. $sequence = $this->createMock(Sequence::class);
  503. $sequence->expects($this->any())
  504. ->method('getName')
  505. ->willReturn(\str_repeat('a', 31));
  506. $schema = $this->createMock(Schema::class);
  507. $schema->expects($this->once())
  508. ->method('getTables')
  509. ->willReturn([]);
  510. $schema->expects($this->once())
  511. ->method('getSequences')
  512. ->willReturn([$sequence]);
  513. $sourceSchema = $this->createMock(Schema::class);
  514. $sourceSchema->expects($this->any())
  515. ->method('getTable')
  516. ->willThrowException(new SchemaException());
  517. $sourceSchema->expects($this->any())
  518. ->method('hasSequence')
  519. ->willReturn(false);
  520. self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
  521. }
  522. }