Completed
Push — master ( 857394...4794c5 )
by Mahmoud
03:25
created

ContactUsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testContactUs() 0 21 1
1
<?php
2
3
namespace App\Containers\Contact\UI\API\Tests\Functional;
4
5
use App\Port\Test\PHPUnit\Abstracts\TestCase;
6
use Illuminate\Support\Facades\Config;
7
use Mail;
8
9
/**
10
 * Class SampleTest.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class ContactUsTest extends TestCase
15
{
16
17
    private $endpoint = '/contact';
18
19
    public function testContactUs()
20
    {
21
        $data = [
22
            'email'   => '[email protected]',
23
            'message' => 'I just want to tell you this App is awesome.',
24
            'name'    => 'Cool User',
25
            'subject' => 'Thank you RewardFox',
26
        ];
27
28
        // mock sending emails
29
        Mail::shouldReceive('queue')->once()->andReturn('true');
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not seem to exist on object<Illuminate\Mail\Mailer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
31
        Config::set('mail.to.address', '[email protected]');
32
        Config::set('mail.to.name', 'Mahmoud');
33
34
        $response = $this->apiCall($this->endpoint, 'post', $data, false);
35
36
        $this->assertEquals($response->getStatusCode(), '202');
37
38
        $this->assertResponseContainKeyValue(['message' => 'Message sent Successfully.'], $response);
39
    }
40
41
}
42