/** * @return Board * * @SuppressWarnings(PHPMD.StaticAccess) */ private function getRandomBoard() { if ($this->boards === null) { $this->boards = Board::all(); } return $this->boards->random(); }
/** * @return void */ public function testUpdate() { $this->beginDatabaseTransaction(); /** @var Model $model */ $this->assertNotNull($model = factory(Model::class)->make()); $model->{Model::FIELD_TITLE} = 'Title'; $model->saveOrFail(); $idx = $model->getKey(); $body = $this->getUpdateRequestBody($idx); /** @var Response $response */ $response = $this->callPatch($this->admin(), $idx, $body); $this->assertResponseOk(); $this->assertNotEmpty($resource = json_decode($response->getContent())->data); $this->assertNotNull($model = Model::find($resource->id)); $this->assertEquals('New value', $model->{Model::FIELD_TITLE}); }