EmailControllerTest
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 0
lcom 0
cbo 1
dl 0
loc 49
c 0
b 0
f 0
1
<?php
2
3
namespace Citrax\Bundle\DatabaseSwiftMailerBundle\Tests\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
7
class EmailControllerTest extends WebTestCase
8
{
9
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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', '/email-spool/');
17
        $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /email-spool/");
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
            'citrax_bundle_databaseswiftmailerbundle_email[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->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
31
32
        // Edit the entity
33
        $crawler = $client->click($crawler->selectLink('Edit')->link());
34
35
        $form = $crawler->selectButton('Update')->form(array(
36
            'citrax_bundle_databaseswiftmailerbundle_email[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->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
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
    */
55
}
56