NotificationsTableTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testAddNotifications() 0 10 1
1
<?php
2
3
namespace App\Test\TestCase\Model\Table;
4
5
use Cake\ORM\TableRegistry;
6
use Cake\TestSuite\TestCase;
7
8
use function count;
9
10
/**
11
 * Notification Test Case.
12
 */
13
class NotificationsTableTest extends TestCase
14
{
15
    /**
16
     * Fixtures.
17
     *
18
     * @var array
19
     */
20
    public $fixtures = [
21
        'app.Notifications',
22
        'app.Developers',
23
        'app.Reports',
24
        'app.Incidents',
25
    ];
26
27
    /**
28
     * setUp method.
29
     */
30
    public function setUp(): void
31
    {
32
        parent::setUp();
33
        $this->Notifications = TableRegistry::getTableLocator()->get('Notifications');
34
    }
35
36
    public function testAddNotifications(): void
37
    {
38
        $report_id = 2;
39
        $developer = TableRegistry::getTableLocator()->get('Developers');
40
        $devs = $developer->find('all');
41
        $devs = $devs->enableHydration(false)->toArray();
42
        $this->Notifications->addNotifications($report_id);
43
        $notifs = $this->Notifications->find('all', ['conditions' => ['report_id' => $report_id]]);
44
        $notifs = $notifs->enableHydration(false)->toArray();
45
        $this->assertEquals(count($notifs), count($devs));
46
    }
47
}
48