@@ -33,46 +33,47 @@ public function testDefinitionNoSchema($column, $generalSchema, $result)
3333 public function withSchemaDataProvider ()
3434 {
3535 return [
36- [['precision ' => 4 ], false , '$this->dateTime(4) ' ],
37- [['precision ' => 4 ], true , '$this->dateTime(4) ' ],
38- [['precision ' => 0 ], false , '$this->dateTime(0) ' ],
39- [['precision ' => 0 ], true , '$this->dateTime(0) ' ],
36+ [['precision ' => 4 ], false , TableStructure::SCHEMA_PGSQL , '' , false , '$this->dateTime(4) ' ],
37+ [['precision ' => 4 ], true , TableStructure::SCHEMA_PGSQL , '' , false , '$this->dateTime(4) ' ],
38+ [['precision ' => 0 ], false , TableStructure::SCHEMA_PGSQL , '' , false , '$this->dateTime(0) ' ],
39+ [['precision ' => 0 ], true , TableStructure::SCHEMA_PGSQL , '' , false , '$this->dateTime(0) ' ],
40+ [['precision ' => 4 ], false , TableStructure::SCHEMA_PGSQL , '' , true , '$this->dateTime(4) ' ],
41+ [['precision ' => 4 ], true , TableStructure::SCHEMA_PGSQL , '' , true , '$this->dateTime(4) ' ],
42+ [['precision ' => 0 ], false , TableStructure::SCHEMA_PGSQL , '' , true , '$this->dateTime(0) ' ],
43+ [['precision ' => 0 ], true , TableStructure::SCHEMA_PGSQL , '' , true , '$this->dateTime() ' ],
44+ [['precision ' => 4 ], false , TableStructure::SCHEMA_MYSQL , '' , false , '$this->dateTime() ' ],
45+ [['precision ' => 4 ], true , TableStructure::SCHEMA_MYSQL , '' , false , '$this->dateTime() ' ],
46+ [['precision ' => 0 ], false , TableStructure::SCHEMA_MYSQL , '' , false , '$this->dateTime() ' ],
47+ [['precision ' => 0 ], true , TableStructure::SCHEMA_MYSQL , '' , false , '$this->dateTime() ' ],
48+ [['precision ' => 4 ], false , TableStructure::SCHEMA_MYSQL , '' , true , '$this->dateTime() ' ],
49+ [['precision ' => 4 ], true , TableStructure::SCHEMA_MYSQL , '' , true , '$this->dateTime() ' ],
50+ [['precision ' => 0 ], false , TableStructure::SCHEMA_MYSQL , '' , true , '$this->dateTime() ' ],
51+ [['precision ' => 0 ], true , TableStructure::SCHEMA_MYSQL , '' , true , '$this->dateTime() ' ],
52+ [['precision ' => 4 ], false , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , false , '$this->dateTime(4) ' ],
53+ [['precision ' => 4 ], true , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , false , '$this->dateTime(4) ' ],
54+ [['precision ' => 0 ], false , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , false , '$this->dateTime(0) ' ],
55+ [['precision ' => 0 ], true , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , false , '$this->dateTime(0) ' ],
56+ [['precision ' => 4 ], false , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , true , '$this->dateTime(4) ' ],
57+ [['precision ' => 4 ], true , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , true , '$this->dateTime(4) ' ],
58+ [['precision ' => 0 ], false , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , true , '$this->dateTime(0) ' ],
59+ [['precision ' => 0 ], true , TableStructure::SCHEMA_MYSQL , '5.6.4 ' , true , '$this->dateTime() ' ],
4060 ];
4161 }
4262
4363 /**
4464 * @dataProvider withSchemaDataProvider
4565 * @param array $column
4666 * @param bool $generalSchema
67+ * @param string $schema
68+ * @param string $version
69+ * @param bool $mapping
4770 * @param string $result
4871 */
49- public function testDefinitionWithSchema ($ column , $ generalSchema , $ result )
72+ public function testDefinitionWithSchema ($ column , $ generalSchema , $ schema , $ version , $ mapping , $ result )
5073 {
51- $ column ['schema ' ] = TableStructure::SCHEMA_PGSQL ;
52- $ column = new TableColumnDateTime ($ column );
53- $ this ->assertEquals ($ result , $ column ->renderDefinition ($ this ->getTable ($ generalSchema )));
54- }
55-
56- public function withMappingAndSchemaDataProvider ()
57- {
58- return [
59- [['precision ' => 4 ], false , '$this->dateTime(4) ' ],
60- [['precision ' => 4 ], true , '$this->dateTime(4) ' ],
61- [['precision ' => 0 ], false , '$this->dateTime(0) ' ],
62- [['precision ' => 0 ], true , '$this->dateTime() ' ],
63- ];
64- }
65-
66- /**
67- * @dataProvider withMappingAndSchemaDataProvider
68- * @param array $column
69- * @param bool $generalSchema
70- * @param string $result
71- */
72- public function testDefinitionWithMappingAndSchema ($ column , $ generalSchema , $ result )
73- {
74- $ column ['schema ' ] = TableStructure::SCHEMA_PGSQL ;
75- $ column ['defaultMapping ' ] = 'timestamp(0) ' ;
74+ $ column ['schema ' ] = $ schema ;
75+ $ column ['engineVersion ' ] = $ version ;
76+ $ column ['defaultMapping ' ] = $ mapping ? 'datetime(0) ' : null ;
7677 $ column = new TableColumnDateTime ($ column );
7778 $ this ->assertEquals ($ result , $ column ->renderDefinition ($ this ->getTable ($ generalSchema )));
7879 }
0 commit comments