src/Company/BaseBundle/Tests/Controller/DocumentControllerTest.php
changeset 2 806e57d67020
equal deleted inserted replaced
1:8cbd576d6b88 2:806e57d67020
       
     1 <?php
       
     2 
       
     3 namespace Company\BaseBundle\Tests\Controller;
       
     4 
       
     5 use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
       
     6 
       
     7 class DocumentControllerTest extends WebTestCase
       
     8 {
       
     9     /*
       
    10     public function testCompleteScenario()
       
    11     {
       
    12         // Create a new client to browse the application
       
    13         $client = static::createClient();
       
    14 
       
    15         // Create a new entry in the database
       
    16         $crawler = $client->request('GET', '/document/');
       
    17         $this->assertTrue(200 === $client->getResponse()->getStatusCode());
       
    18         $crawler = $client->click($crawler->selectLink('Create a new entry')->link());
       
    19 
       
    20         // Fill in the form and submit it
       
    21         $form = $crawler->selectButton('Create')->form(array(
       
    22             'document[field_name]'  => 'Test',
       
    23             // ... other fields to fill
       
    24         ));
       
    25 
       
    26         $client->submit($form);
       
    27         $crawler = $client->followRedirect();
       
    28 
       
    29         // Check data in the show view
       
    30         $this->assertTrue($crawler->filter('td:contains("Test")')->count() > 0);
       
    31 
       
    32         // Edit the entity
       
    33         $crawler = $client->click($crawler->selectLink('Edit')->link());
       
    34 
       
    35         $form = $crawler->selectButton('Edit')->form(array(
       
    36             'document[field_name]'  => 'Foo',
       
    37             // ... other fields to fill
       
    38         ));
       
    39 
       
    40         $client->submit($form);
       
    41         $crawler = $client->followRedirect();
       
    42 
       
    43         // Check the element contains an attribute with value equals "Foo"
       
    44         $this->assertTrue($crawler->filter('[value="Foo"]')->count() > 0);
       
    45 
       
    46         // Delete the entity
       
    47         $client->submit($crawler->selectButton('Delete')->form());
       
    48         $crawler = $client->followRedirect();
       
    49 
       
    50         // Check the entity has been delete on the list
       
    51         $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
       
    52     }
       
    53     */
       
    54 }