|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the jquery-datatables-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2018 WEBEWEB |
|
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 WBW\Bundle\JQuery\DataTablesBundle\Tests\Event; |
|
13
|
|
|
|
|
14
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Event\DataTablesEvent; |
|
15
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Provider\DataTablesProviderInterface; |
|
16
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Tests\AbstractTestCase; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* DataTables event test. |
|
20
|
|
|
* |
|
21
|
|
|
* @author webeweb <https://github.com/webeweb> |
|
22
|
|
|
* @package WBW\Bundle\JQuery\DataTablesBundle\Tests\Event |
|
23
|
|
|
*/ |
|
24
|
|
|
class DataTablesEventTest extends AbstractTestCase { |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Test __construct() |
|
28
|
|
|
* |
|
29
|
|
|
* @return void |
|
30
|
|
|
*/ |
|
31
|
|
|
public function test__construct(): void { |
|
32
|
|
|
|
|
33
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.pre_delete", DataTablesEvent::PRE_DELETE); |
|
34
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.pre_edit", DataTablesEvent::PRE_EDIT); |
|
35
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.pre_export", DataTablesEvent::PRE_EXPORT); |
|
36
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.pre_index", DataTablesEvent::PRE_INDEX); |
|
37
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.pre_serialize", DataTablesEvent::PRE_SERIALIZE); |
|
38
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.pre_show", DataTablesEvent::PRE_SHOW); |
|
39
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.post_delete", DataTablesEvent::POST_DELETE); |
|
40
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.post_edit", DataTablesEvent::POST_EDIT); |
|
41
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.post_export", DataTablesEvent::POST_EXPORT); |
|
42
|
|
|
$this->assertEquals("wbw.jquery.datatables.event.post_index", DataTablesEvent::POST_INDEX); |
|
43
|
|
|
|
|
44
|
|
|
// Set a DataTables provider mock. |
|
45
|
|
|
$provider = $this->getMockBuilder(DataTablesProviderInterface::class)->getMock(); |
|
46
|
|
|
|
|
47
|
|
|
$obj = new DataTablesEvent("eventName", [], $provider); |
|
48
|
|
|
|
|
49
|
|
|
$this->assertEquals("eventName", $obj->getEventName()); |
|
50
|
|
|
$this->assertEquals([], $obj->getEntities()); |
|
51
|
|
|
$this->assertSame($provider, $obj->getProvider()); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|