prophesize('\Drupal\pgsql\Driver\Database\pgsql\Connection'); $connection->getConnectionOptions()->willReturn([]); $connection->getPrefix()->willReturn(''); $statement = $this->prophesize('\Drupal\Core\Database\StatementInterface'); $statement->fetchField()->willReturn($max_identifier_length); $connection->query('SHOW max_identifier_length')->willReturn($statement->reveal()); $connection->query(Argument::containingString($expected)) ->willReturn($this->prophesize('\Drupal\Core\Database\StatementInterface')->reveal()) ->shouldBeCalled(); $schema = new Schema($connection->reveal()); $schema->constraintExists($table_name, $name); } /** * Data provider for ::testComputedConstraintName(). */ public static function providerComputedConstraintName() { return [ ['user_field_data', 'pkey', 'user_field_data____pkey'], ['user_field_data', 'name__key', 'user_field_data__name__key'], [ 'user_field_data', 'a_very_very_very_very_super_long_field_name__key', 'drupal_WW_a8TlbZ3UQi20UTtRlJFaIeSa6FEtQS5h4NRA3UeU_key', ], ]; } }