setFetchMode(true); $this->connection = new Connection($config); DbManager::getInstance()->addConnection($this->connection); $connection = DbManager::getInstance()->getConnection(); $this->assertTrue($connection === $this->connection); } public function testAdd() { $testUserModel = new TestUserModel(); $testUserModel->state = 1; $testUserModel->name = 'Siam'; $testUserModel->age = 18; $testUserModel->addTime = date('Y-m-d H:i:s'); $data = $testUserModel->save(false, false); $this->assertIsInt($data); } public function testQuery() { $cursor = TestUserModel::create()->all(); $this->assertInstanceOf(Cursor::class, $cursor); } public function testCursorNotArray() { $cursor = TestUserModel::create()->all(); $item = $cursor->fetch(); $this->assertInstanceOf(TestUserModel::class, $item); } }