'bigint', 'dbType' => 'int8', 'phpType' => 'integer', 'allowNull' => true, 'autoIncrement' => false, 'enumValues' => null, 'size' => null, 'precision' => 64, 'scale' => 0, 'defaultValue' => null, ]; return $columns; } public function testGetPDOType() { $values = [ [null, \PDO::PARAM_NULL], ['', \PDO::PARAM_STR], ['hello', \PDO::PARAM_STR], [0, \PDO::PARAM_INT], [1, \PDO::PARAM_INT], [1337, \PDO::PARAM_INT], [true, \PDO::PARAM_BOOL], [false, \PDO::PARAM_BOOL], [$fp = fopen(__FILE__, 'rb'), \PDO::PARAM_LOB], ]; /* @var $schema Schema */ $schema = $this->getConnection()->schema; foreach ($values as $value) { $this->assertEquals($value[1], $schema->getPdoType($value[0])); } fclose($fp); } public function testBooleanDefaultValues() { /* @var $schema Schema */ $schema = $this->getConnection()->schema; $table = $schema->getTableSchema('bool_values'); $this->assertSame(true, $table->getColumn('default_true')->defaultValue); $this->assertSame(false, $table->getColumn('default_false')->defaultValue); } public function testFindSchemaNames() { $schema = $this->getConnection()->schema; $this->assertEquals(3, count($schema->getSchemaNames())); } public function bigintValueProvider() { return [ [8817806877], [3797444208], [3199585540], [1389831585], [922337203685477580], [9223372036854775807], [-9223372036854775808] ]; } /** * @dataProvider bigintValueProvider */ public function testBigintValue($bigint) { $this->mockApplication(); ActiveRecord::$db = $this->getConnection(); Type::deleteAll(); $type = new Type(); $type->setAttributes([ 'bigint_col' => $bigint, // whatever just to satisfy NOT NULL columns 'int_col' => 1, 'char_col' => 'a', 'float_col' => 0.1, 'bool_col' => true, ], false); $type->save(false); $actual = Type::find()->one(); $this->assertEquals($bigint, $actual->bigint_col); } }