connection = new Connection($config); DbManager::getInstance()->addConnection($this->connection); $connection = DbManager::getInstance()->getConnection(); $this->assertTrue($connection === $this->connection); } public function testAdd() { $testUserModel = new TestUserListModel(); $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 testEmpty() { $test = TestUserListModel::create()->where(['name' => 'Siam'])->get(); $res = !empty($test->name); $resNot = !empty($test->testaaa); $this->assertTrue($res); $this->assertNotTrue($resNot); } public function testIsset() { $test = TestUserListModel::create()->where(['name' => 'Siam'])->get(); $res = isset($test->name); $resNot = isset($test->testaaa); $this->assertTrue($res); $this->assertNotTrue($resNot); } public function testDeleteAll() { $res = TestUserListModel::create()->destroy(null, true); $this->assertIsInt($res); } }