connection = new Connection($config); DbManager::getInstance()->addConnection($this->connection); $connection = DbManager::getInstance()->getConnection(); $this->assertTrue($connection === $this->connection); } public function testAdd() { $testUserModel = new TestUserListGetterModel(); $testUserModel->state = 1; $testUserModel->name = 'Siam'; $testUserModel->age = 18; $testUserModel->addTime = date('Y-m-d H:i:s'); $data = $testUserModel->save(); $this->assertIsInt($data); } public function testGetter() { $test = TestUserListGetterModel::create()->all(); $this->assertEquals($test[0]->addTime, 123); } public function testGetterJson() { $test = TestUserListGetterModel::create()->all(); $json = json_encode($test); $decode = json_decode($json); $this->assertEquals($decode[0]->addTime, 123); } public function testDeleteAll() { $res = TestUserListGetterModel::create()->destroy(null, true); $this->assertIsInt($res); } }