From 848d212e7ac0eea81cd66486248b0e6af28e52d3 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Wed, 6 Jul 2016 14:42:59 +1000 Subject: [PATCH] MDL-53495 database xmldb: Ensure field tests use constant. Some tests were still using hard coded values which break if the constants are changed. --- lib/ddl/tests/ddl_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ddl/tests/ddl_test.php b/lib/ddl/tests/ddl_test.php index e317c5f8c4f..0338badb4a3 100644 --- a/lib/ddl/tests/ddl_test.php +++ b/lib/ddl/tests/ddl_test.php @@ -340,7 +340,7 @@ class core_ddl_testcase extends database_driver_testcase { // Weird column names - the largest allowed. $table = new xmldb_table('test_table3'); $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('abcdef____0123456789_______xyz', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '2'); + $table->add_field(str_repeat('b', xmldb_field::NAME_MAX_LENGTH), XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '2'); $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); $table->setComment("This is a test'n drop table. You can drop it safely"); @@ -350,10 +350,10 @@ class core_ddl_testcase extends database_driver_testcase { $this->assertTrue($dbman->table_exists($table)); $dbman->drop_table($table); - // Too long field name - max 30. + // Too long field name. $table = new xmldb_table('test_table4'); $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); - $table->add_field('abcdeabcdeabcdeabcdeabcdeabcdez', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '2'); + $table->add_field(str_repeat('a', xmldb_field::NAME_MAX_LENGTH + 1), XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '2'); $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); $table->setComment("This is a test'n drop table. You can drop it safely");