Completed
Push — analysis-qyrRRN ( f76f51 )
by Sullivan
12:31 queued 09:52
created

MessageManagerBackendDispatcherTest::testCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 2
Metric Value
c 4
b 1
f 2
dl 0
loc 23
rs 9.0856
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project 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\Backend;
13
14
use Sonata\NotificationBundle\Backend\MessageManagerBackendDispatcher;
15
use Sonata\NotificationBundle\Model\Message;
16
17
/**
18
 * @author Hugo Briand <[email protected]>
19
 */
20
class MessageManagerBackendDispatcherTest extends \PHPUnit_Framework_TestCase
21
{
22
    public function testCreate()
23
    {
24
        $testBackend = $this->getMockBuilder('Sonata\NotificationBundle\Backend\MessageManagerBackend')
25
            ->disableOriginalConstructor()
26
            ->getMock();
27
28
        $testBackend->expects($this->once())
29
            ->method('setDispatcher');
30
31
        $message = new Message();
32
        $message->setType('test');
33
        $message->setBody([]);
34
35
        $testBackend->expects($this->once())
36
            ->method('create')
37
            ->will($this->returnValue($message));
38
39
        $mMgr = $this->getMock('Sonata\NotificationBundle\Model\MessageManagerInterface');
40
41
        $mMgrBackend = new MessageManagerBackendDispatcher($mMgr, [], '', [['types' => ['test'], 'backend' => $testBackend]]);
42
43
        $this->assertEquals($message, $mMgrBackend->create('test', []));
44
    }
45
}
46