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

BackendHealthCheckTest::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 0
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