Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-29566 unit tests - add some tests to cover get_columns() with num…

…ber/float columns
  • Loading branch information...
commit 3264974513ba8eebc692e20499768eb89d507ea8 1 parent 3973662
@stronk7 stronk7 authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 lib/dml/simpletest/testdml.php
View
18 lib/dml/simpletest/testdml.php
@@ -727,6 +727,8 @@ public function test_get_columns() {
$table->add_field('description', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
$table->add_field('enumfield', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, 'test2');
$table->add_field('onenum', XMLDB_TYPE_NUMBER, '10,2', null, null, null, 200);
+ $table->add_field('onefloat', XMLDB_TYPE_FLOAT, '10,2', null, null, null, 300);
+ $table->add_field('anotherfloat', XMLDB_TYPE_FLOAT, null, null, null, null, 400);
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$dbman->create_table($table);
@@ -771,10 +773,26 @@ public function test_get_columns() {
$field = $columns['onenum'];
$this->assertEqual('N', $field->meta_type);
$this->assertFalse($field->auto_increment);
+ $this->assertEqual(10, $field->max_length);
+ $this->assertEqual(2, $field->scale);
$this->assertTrue($field->has_default);
$this->assertEqual(200.0, $field->default_value);
$this->assertFalse($field->not_null);
+ $field = $columns['onefloat'];
+ $this->assertEqual('N', $field->meta_type);
+ $this->assertFalse($field->auto_increment);
+ $this->assertTrue($field->has_default);
+ $this->assertEqual(300.0, $field->default_value);
+ $this->assertFalse($field->not_null);
+
+ $field = $columns['anotherfloat'];
+ $this->assertEqual('N', $field->meta_type);
+ $this->assertFalse($field->auto_increment);
+ $this->assertTrue($field->has_default);
+ $this->assertEqual(400.0, $field->default_value);
+ $this->assertFalse($field->not_null);
+
for ($i = 0; $i < count($columns); $i++) {
if ($i == 0) {
$next_column = reset($columns);
Please sign in to comment.
Something went wrong with that request. Please try again.