find(1, $model); $this->assertEquals("林田商会", $model->getStr(Customer::FIELD_CUSTOMER_NAME)); $memo = Now::get()->format("YmdHis"); $model->set(Customer::FIELD_CUSTOMER_MEMO, $memo); $beforeRevision = $model->getRevision(); $access->update($model); $afterRevision = $model->getRevision(); $this->assertEquals($beforeRevision + 1, $afterRevision); // 再度データを取得して項目が更新されていることを確認 $model = new Customer(); $access->find(1, $model); $this->assertEquals($memo, $model->getStr(Customer::FIELD_CUSTOMER_MEMO)); } public function test_CarRoom(): void { $model = new CarRoom(); $access = new KintoneAccess(CarRoom::class); $access->find(1, $model); $this->assertEquals("岩渕パーク", $model->getStr(CarRoom::FIELD_PARK_NAME)); $this->assertEquals("5000", $model->getTable(CarRoom::FIELD_TABLE_FEE)[0][CarRoom::FIELD_TABLE_FEE_AMOUNT_PER_MONTH]); $this->assertEquals("自転車", $model->get(CarRoom::FIELD_CAN_USE_VEHICLE_TYPE)[0]); $this->assertEquals("普通自動車", $model->get(CarRoom::FIELD_CAN_USE_VEHICLE_TYPE)[1]); } public function test_small() { $model = new Small(); $access = new KintoneAccess(Small::class); $model->set(Small::FIELD_NAME, "iwabuchi"); $model->set(Small::FIELD_AGE, "32"); $res = $access->create($model); $this->assertTrue($res->ok()); } /** * @group cursor */ public function test_cursor() { $access = new KintoneAccess(Small::class); $now = Now::get(); $query = Small::query() ->whereIn(Small::FIELD_NAME, ["iwabuchi", "aa"]) ->where(Small::FIELD_AGE, 32) ->whereDateTime(Small::FIELD_CREATED_TIME, $now, KintoneRecordQueryOperator::LT); $access->createCursor($query); $ret = $access->next(); $this->assertTrue($ret instanceof Collection); $this->assertSame(1, $ret->count()); $this->assertSame("iwabuchi", $ret->first()->getStr(Small::FIELD_NAME)); } /** * @group cursor */ public function test_cursor_all() { $access = new KintoneAccess(Small::class); $now = Now::get(); $query = Small::query() ->orderByAsc(Small::FIELD_NAME); $ret = $access->all($query, [ Small::FIELD_NAME, Small::FIELD_AGE, ]); $this->assertTrue($ret instanceof Collection); $this->assertSame(2, $ret->count()); $first = $ret->first(); $this->assertInstanceOf(Small::class, $first); $this->assertSame("iwabuchi", $ret->first()->getStr(Small::FIELD_NAME)); $this->assertSame(32, $ret->first()->getNumber(Small::FIELD_AGE)); } }