Unverified Commit eca1c525 authored by Michael Moravec's avatar Michael Moravec Committed by Sergei Morozov

Add functional test for auto-detected sequence definition

parent 642fc86e
...@@ -18,6 +18,7 @@ use function array_filter; ...@@ -18,6 +18,7 @@ use function array_filter;
use function array_keys; use function array_keys;
use function array_map; use function array_map;
use function array_search; use function array_search;
use function array_values;
use function count; use function count;
use function current; use function current;
use function end; use function end;
...@@ -25,6 +26,7 @@ use function explode; ...@@ -25,6 +26,7 @@ use function explode;
use function get_class; use function get_class;
use function in_array; use function in_array;
use function str_replace; use function str_replace;
use function strcasecmp;
use function strlen; use function strlen;
use function strtolower; use function strtolower;
use function substr; use function substr;
...@@ -1454,4 +1456,37 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest ...@@ -1454,4 +1456,37 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
self::assertEquals($sequence2AllocationSize, $actualSequence2->getAllocationSize()); self::assertEquals($sequence2AllocationSize, $actualSequence2->getAllocationSize());
self::assertEquals($sequence2InitialValue, $actualSequence2->getInitialValue()); self::assertEquals($sequence2InitialValue, $actualSequence2->getInitialValue());
} }
/**
* @group #3086
*/
public function testComparisonWithAutoDetectedSequenceDefinition() : void
{
if (! $this->_sm->getDatabasePlatform()->supportsSequences()) {
self::markTestSkipped('This test is only supported on platforms that support sequences.');
}
$sequenceName = 'sequence_auto_detect_test';
$sequenceAllocationSize = 5;
$sequenceInitialValue = 10;
$sequence = new Sequence($sequenceName, $sequenceAllocationSize, $sequenceInitialValue);
$this->_sm->dropAndCreateSequence($sequence);
$createdSequence = array_values(
array_filter(
$this->_sm->listSequences(),
function (Sequence $sequence) use ($sequenceName) : bool {
return strcasecmp($sequence->getName(), $sequenceName) === 0;
}
)
)[0] ?? null;
self::assertNotNull($createdSequence);
$comparator = new Comparator();
$tableDiff = $comparator->diffSequence($createdSequence, $sequence);
self::assertFalse($tableDiff);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment