public function testEnabled() { $this->initDB(); $this->assertFalse((bool) Note::find($this->noteViewed->id)->viewed); $exitCode = Artisan::call('note:edit', ['id' => $this->noteViewed->id, '--viewed' => 'true']); $this->assertEquals($exitCode, 0); $this->assertContains('The note has been updated', Artisan::output()); /* * I use the seeder to re-initialize the table because Artisan:call is another instance of DB */ $this->assertTrue((bool) Note::find($this->noteViewed->id)->viewed); }
/** * {@inheritdoc}. */ protected function getObjectByArguments() { return Note::find($this->argument('id')); }
/** * {@inheritdoc}. */ protected function getModelFromRequest() { return Note::find($this->argument('id')); }
/** * Remove the specified resource from storage. * * @param NoteFormRequest $noteForm * * @return \Illuminate\Http\Response */ public function destroy(NoteFormRequest $noteForm) { $input = $noteForm->all(); $note = Note::find($input['note']); $note->delete(); return 'delete:OK'; }