assertCollation example

// Assert that the table exists.     $this->assertTrue($this->schema->tableExists('test_table'), 'The table exists.');

    // Assert that the table comment has been set.     $this->checkSchemaComment($table_specification['description'], 'test_table');

    // Assert that the column comment has been set.     $this->checkSchemaComment($table_specification['fields']['test_field']['description'], 'test_table', 'test_field');

    // Make sure that fields have the correct collation, if supported.     $this->assertCollation();

    // An insert without a value for the column 'test_table' should fail.     $this->assertFalse($this->tryInsert(), 'Insert without a default failed.');

    // Add a default value to the column.     $this->schema->changeField('test_table', 'test_field', 'test_field', ['type' => 'int', 'not null' => TRUE, 'default' => 0]);
    // The insert should now succeed.     $this->assertTrue($this->tryInsert(), 'Insert with a default succeeded.');

    // Remove the default.     $this->schema->changeField('test_table', 'test_field', 'test_field', ['type' => 'int', 'not null' => TRUE]);
    
Home | Imprint | This part of the site doesn't use cookies.