示例#1
0
 /**
  * Tests the getPaste method's 'remattach' action
  */
 public function testGetPasteRemAttach()
 {
     $this->initTestStep();
     $paste = Paste::createNew('web', array('title' => 'UnitTest::Title', 'data' => 'UnitTest::Data', 'password' => 'UnitTest::Password', 'language' => 'text', 'attachment' => array(true)));
     File::put(storage_path() . "/uploads/{$paste->urlkey}", 'attachment');
     $this->call('GET', "admin/paste/{$paste->urlkey}/remattach");
     $this->assertRedirectedTo('/');
     $this->assertEquals(Paste::find($paste->id)->attachment, 0);
     $this->assertFalse(File::exists(storage_path() . "/uploads/{$paste->urlkey}"));
 }
示例#2
0
 /**
  * Tests the getPaste's 'unflag' action
  */
 public function testGetPasteUnflag()
 {
     $this->initTestStep();
     $paste = Paste::createNew('web', array('title' => 'UnitTest::Title', 'data' => 'UnitTest::Data', 'language' => 'text', 'private' => 1));
     $paste->update(array('flagged', 1));
     $this->call('GET', "{$paste->urlkey}/{$paste->hash}/unflag");
     $this->assertRedirectedTo('/');
     $this->assertSessionHas('messages.success');
     $this->assertEquals(Paste::find($paste->id)->flagged, 0);
 }