connection = new Connection($config); DbManager::getInstance()->addConnection($this->connection); $connection = DbManager::getInstance()->getConnection(); $this->assertTrue($connection === $this->connection); } /** * @throws Exception * @throws \EasySwoole\Mysqli\Exception\Exception * @throws \Throwable */ public function testGet() { TestTimeStampModel::create([ 'name' => 'siam_test_clone', 'age' => 22, ])->save(); $model = new TestRelationModel(); $cloneModel = $model->tableName("tiamstamp_test")->get(); $this->assertEquals($cloneModel->getTableName(), 'tiamstamp_test'); } /** * @throws Exception * @throws \EasySwoole\Mysqli\Exception\Exception * @throws \Throwable */ public function testSaveAll() { $model = new TestRelationModel(); $model->tableName("tiamstamp_test")->saveAll([ [ 'name' => 'siam_test_clone_1', 'age' => 22, ], [ 'name' => 'siam_test_clone_2', 'age' => 22, ] ]); $com = TestTimeStampModel::create()->get([ 'name' => 'siam_test_clone_2' ]); $this->assertEquals($com->name, "siam_test_clone_2"); } public function testAfter() { TestTimeStampModel::create()->destroy(null, true); } }