Code Duplication    Length = 11-13 lines in 6 locations

tests/test-Check_Notifications.php 6 locations

@@ 9-20 (lines=12) @@
6
        parent::setUp();
7
    }
8
9
    public function testSendFriendEmail()
10
    {
11
        add_filter('wp_mail', 'print_mail');
12
        ob_start();
13
        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend');
14
        $output = ob_get_clean();
15
        remove_filter('wp_mail', 'print_mail');
16
        $this->assertContains( 'thought you might be interested in', $output );
17
        $this->assertContains( 'Your friend has sent you a message from', $output );
18
        $this->assertContains( '[email protected]', $output );
19
        $this->assertContains( 'ADMIN BCC COPY', $output );
20
    }
21
22
    public function testSendEnquiryEmail()
23
    {
@@ 22-33 (lines=12) @@
19
        $this->assertContains( 'ADMIN BCC COPY', $output );
20
    }
21
22
    public function testSendEnquiryEmail()
23
    {
24
        add_filter('wp_mail', 'print_mail');
25
        ob_start();
26
        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry');
27
        $output = ob_get_clean();
28
        remove_filter('wp_mail', 'print_mail');
29
        $this->assertContains( 'Website Enquiry', $output );
30
        $this->assertContains( 'An enquiry has been sent from', $output );
31
        $this->assertContains( '[email protected]', $output );
32
        $this->assertContains( 'ADMIN BCC COPY', $output );
33
    }
34
35
    public function testForgotPassEmail()
36
    {
@@ 35-45 (lines=11) @@
32
        $this->assertContains( 'ADMIN BCC COPY', $output );
33
    }
34
35
    public function testForgotPassEmail()
36
    {
37
        add_filter('wp_mail', 'print_mail');
38
        ob_start();
39
        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password');
40
        $output = ob_get_clean();
41
        remove_filter('wp_mail', 'print_mail');
42
        $this->assertContains( 'Your new password', $output );
43
        $this->assertContains( 'You requested a new password for', $output );
44
        $this->assertContains( '[email protected]', $output );
45
    }
46
47
    public function testRegistrationEmail()
48
    {
@@ 47-58 (lines=12) @@
44
        $this->assertContains( '[email protected]', $output );
45
    }
46
47
    public function testRegistrationEmail()
48
    {
49
        add_filter('wp_mail', 'print_mail');
50
        ob_start();
51
        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration');
52
        $output = ob_get_clean();
53
        remove_filter('wp_mail', 'print_mail');
54
        $this->assertContains( 'Your Log In Details', $output );
55
        $this->assertContains( 'You can log in  with the following information', $output );
56
        $this->assertContains( '[email protected]', $output );
57
        $this->assertContains( 'ADMIN BCC COPY', $output );
58
    }
59
60
    public function testPostSubmitEmail()
61
    {
@@ 60-72 (lines=13) @@
57
        $this->assertContains( 'ADMIN BCC COPY', $output );
58
    }
59
60
    public function testPostSubmitEmail()
61
    {
62
        add_filter('wp_mail', 'print_mail');
63
        ob_start();
64
        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit');
65
        $output = ob_get_clean();
66
        remove_filter('wp_mail', 'print_mail');
67
        $this->assertContains( 'Post Submitted Successfully', $output );
68
        $this->assertContains( 'You submitted the below listing information', $output );
69
        $this->assertContains( '[email protected]', $output );
70
        $this->assertContains( 'ADMIN BCC COPY', $output );
71
        $this->assertContains( 'A new  listing has been published', $output );
72
    }
73
74
    public function testListingPublishedEmail()
75
    {
@@ 74-85 (lines=12) @@
71
        $this->assertContains( 'A new  listing has been published', $output );
72
    }
73
74
    public function testListingPublishedEmail()
75
    {
76
        add_filter('wp_mail', 'print_mail');
77
        ob_start();
78
        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published');
79
        $output = ob_get_clean();
80
        remove_filter('wp_mail', 'print_mail');
81
        $this->assertContains( 'Listing Published Successfully', $output );
82
        $this->assertContains( 'Your listing  has been published', $output );
83
        $this->assertContains( '[email protected]', $output );
84
        $this->assertContains( 'ADMIN BCC COPY', $output );
85
    }
86
87
    public function tearDown()
88
    {