Skip to content

Instantly share code, notes, and snippets.

@gilsondev
Created August 6, 2015 19:00
Show Gist options
  • Save gilsondev/fa8d2aa01b4e2edf88ac to your computer and use it in GitHub Desktop.
Save gilsondev/fa8d2aa01b4e2edf88ac to your computer and use it in GitHub Desktop.
<?php
namespace PROCERGS\LoginCidadao\CoreBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;
class ProfileControllerTest extends WebTestCase
{
/**
* @var \Doctrine\ORM\EntityManager
*/
protected $em;
protected $dummyuser;
protected $client;
public function setUp()
{
$kernel = static::createKernel();
$kernel->boot();
$this->em = $kernel->getContainer()->get('doctrine.orm.entity_manager');
$this->em->beginTransaction();
$this->client = static::createClient();
$usermanager = $kernel->getContainer()->get('fos_user.user_manager');
$this->dummyuser = $usermanager->createUser();
$this->dummyuser->setUsername("test");
$this->dummyuser->setEmail("test@mail.com");
$this->dummyuser->setPlainPassword("test123");
$usermanager->updateUser($this->dummyuser);
$this->em->close();
}
/**
* Access profile without user
*/
public function testAccessProfileWithoutAccount()
{
$crawler = $this->client->request('GET', '/profile/edit');
$this->assertEquals(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode());
$this->assertRegExp('/\/login$/', $this->client->getResponse()->headers->get('location'));
}
/**
* Editando o perfil do usuario de teste
*/
public function testEditProfile()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment