예제 #1
0
 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);
 }
예제 #2
0
 /**
  * {@inheritdoc}.
  */
 protected function getObjectByArguments()
 {
     return Note::find($this->argument('id'));
 }
예제 #3
0
 /**
  * {@inheritdoc}.
  */
 protected function getModelFromRequest()
 {
     return Note::find($this->argument('id'));
 }
예제 #4
0
 /**
  * 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';
 }