Skip to content

Commit

Permalink
updated tests adminannouncementcontroller
Browse files Browse the repository at this point in the history
  • Loading branch information
yazbahar committed Jun 27, 2016
1 parent a068172 commit 8dd8ddd
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Ojs\AdminBundle\Tests\Controller;

use Ojs\AdminBundle\Entity\AdminAnnouncement;
use Ojs\CoreBundle\Tests\BaseTestSetup as BaseTestCase;

class AdminAnnouncementControllerTest extends BaseTestCase
Expand Down Expand Up @@ -69,10 +70,22 @@ public function testEdit()

public function testDelete()
{

$em = $this->em;

$announcement = new AdminAnnouncement();
$announcement->setTitle('Delete Title - phpunit');
$announcement->setContent('Delete Content - phpunit');

$em->persist($announcement);
$em->flush();

$id = $announcement->getId();

$this->logIn();
$client = $this->client;
$token = $client->getContainer()->get('security.csrf.token_manager')->getToken('ojs_admin_announcement2');
$client->request('DELETE', '/admin/announcement/2/delete', array('_token' => $token));
$token = $this->generateToken('ojs_admin_announcement'.$id);
$client->request('DELETE', '/admin/announcement/'.$id.'/delete', array('_token' => $token));

$this->assertStatusCode(302, $client);
}
Expand Down

0 comments on commit 8dd8ddd

Please sign in to comment.