Completed
Push — master ( 9abbc7...a687e5 )
by Fabrizio
03:03
created

SenderFactorySpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 5
c 1
b 1
f 0
lcom 0
cbo 1
dl 0
loc 45
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_get_a_dynamic_sender_checking_array_type_GET_SINGLE() 0 9 1
A it_get_a_dynamic_sender_checking_array_type_GET_MULTIPLE() 0 11 1
A it_get_the_send_group_sender() 0 7 1
1
<?php
2
3
namespace spec\Fenos\Notifynder\Senders;
4
5
use Fenos\Notifynder\Contracts\NotifynderCategory;
6
use Fenos\Notifynder\Contracts\NotifynderGroup;
7
use Fenos\Notifynder\Senders\SendGroup;
8
use Fenos\Notifynder\Senders\SendMultiple;
9
use Fenos\Notifynder\Senders\SendOne;
10
use PhpSpec\ObjectBehavior;
11
12
class SenderFactorySpec extends ObjectBehavior
13
{
14
    public function let(NotifynderGroup $notifynderGroup, NotifynderCategory $notifynderCategory)
15
    {
16
        $this->beConstructedWith($notifynderGroup, $notifynderCategory);
17
    }
18
19
    public function it_is_initializable()
20
    {
21
        $this->shouldHaveType('Fenos\Notifynder\Senders\SenderFactory');
22
    }
23
24
    /** @test */
25
    public function it_get_a_dynamic_sender_checking_array_type_GET_SINGLE()
26
    {
27
        // if the array is multidimensional then
28
        // send multiple
29
        $notification = [];
30
        $category = 1;
31
32
        $this->getSender($notification, $category)->shouldReturnAnInstanceOf(SendOne::class);
33
    }
34
35
    /** @test */
36
    public function it_get_a_dynamic_sender_checking_array_type_GET_MULTIPLE()
37
    {
38
        // if the array is multidimensional then
39
        // send multiple
40
        $notification = [
41
            0 => [],
42
        ];
43
        $category = 1;
44
45
        $this->getSender($notification, $category)->shouldReturnAnInstanceOf(SendMultiple::class);
46
    }
47
48
    /** @test */
49
    public function it_get_the_send_group_sender()
50
    {
51
        $group_name = 'mygroup';
52
        $info = [];
53
54
        $this->sendGroup($group_name, $info)->shouldReturnAnInstanceOf(SendGroup::class);
55
    }
56
}
57