Completed
Push — 2.x-dev-kit ( 8d77e1 )
by
unknown
28:22 queued 25:50
created

BackendHealthCheckTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 2
A testCheck() 0 11 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\NotificationBundle\Tests\Notification;
13
14
use Sonata\NotificationBundle\Backend\BackendHealthCheck;
15
use ZendDiagnostics\Result\Success;
16
17
class BackendHealthCheckTest extends \PHPUnit_Framework_TestCase
18
{
19
    public function setUp()
20
    {
21
        if (!class_exists('ZendDiagnostics\Result\Success')) {
22
            $this->markTestSkipped('ZendDiagnostics\Result\Success does not exist');
23
        }
24
    }
25
26
    public function testCheck()
27
    {
28
        $result = new Success('Test check', 'OK');
29
30
        $backend = $this->getMock('Sonata\NotificationBundle\Backend\BackendInterface');
31
        $backend->expects($this->once())->method('getStatus')->will($this->returnValue($result));
32
33
        $health = new BackendHealthCheck($backend);
34
35
        $this->assertEquals($result, $health->check());
36
    }
37
}
38