Completed
Push — master ( 659231...788af6 )
by Wanderson
05:06
created

AlertTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetMessage() 0 4 1
A testGetType() 0 7 1
A testAddAlertOnSession() 0 9 1
1
<?php
2
3
namespace Win\Alert;
4
5
use Win\Alert\AlertError;
6
7
class AlertTest extends \PHPUnit_Framework_TestCase {
8
9
	public function testGetMessage() {
10
		$instance = new AlertError('My Alert');
11
		$this->assertEquals('My Alert', $instance->message);
12
	}
13
14
	public function testGetType() {
15
		$instance = new AlertError('My Error msg');
16
		$this->assertEquals('danger', $instance->type);
17
18
		$instance2 = new AlertSuccess('My Success msg');
19
		$this->assertEquals('success', $instance2->type);
20
	}
21
22
	public function testAddAlertOnSession() {
23
		Session::showAlerts();
24
		new AlertError('My Alert 01');
25
		new AlertError('My Alert 02');
26
		$this->assertEquals(2, count(Session::getAlerts()));
27
28
		Session::showAlerts();
29
		$this->assertEquals(0, count(Session::getAlerts()));
30
	}
31
32
}
33