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; |
13
|
|
|
|
14
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
15
|
|
|
use Throwable; |
16
|
|
|
use WBW\Bundle\CoreBundle\Config\ConfigurationHelper; |
17
|
|
|
use WBW\Bundle\CoreBundle\Tests\AbstractWebTestCase as WebTestCase; |
18
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\TestFixtures; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Abstract web test case. |
22
|
|
|
* |
23
|
|
|
* @author webeweb <https://github.com/webeweb> |
24
|
|
|
* @package WBW\Bundle\JQuery\DataTablesBundle\Tests |
25
|
|
|
* @abstract |
26
|
|
|
*/ |
27
|
|
|
abstract class AbstractWebTestCase extends WebTestCase { |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* List CSS assets. |
31
|
|
|
* |
32
|
|
|
* @return string[] Returns the CSS assets list. |
33
|
|
|
*/ |
34
|
|
|
public static function listCSSAssets(): array { |
35
|
|
|
|
36
|
|
|
$directory = realpath(__DIR__ . "/../DependencyInjection"); |
37
|
|
|
|
38
|
|
|
// Load the YAML configuration. |
39
|
|
|
$config = ConfigurationHelper::loadYamlConfig($directory, "assets"); |
40
|
|
|
$version = $config["assets"]["wbw.jquery_datatables.asset.jquery_datatables"]["version"]; |
41
|
|
|
$plugins = $config["assets"]["wbw.jquery_datatables.asset.jquery_datatables"]["plugins"]; |
42
|
|
|
|
43
|
|
|
$assets = []; |
44
|
|
|
|
45
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-' . $version . '/css/dataTables.bootstrap.min.css"'; |
46
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-autofill-' . $plugins["autofill"]["version"] . '/css/autoFill.bootstrap.min.css"'; |
47
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/css/buttons.bootstrap.min.css"'; |
48
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-colreorder-' . $plugins["colreorder"]["version"] . '/css/colReorder.bootstrap.min.css"'; |
49
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-fixedcolumns-' . $plugins["fixedcolumns"]["version"] . '/css/fixedColumns.bootstrap.min.css"'; |
50
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-fixedheader-' . $plugins["fixedheader"]["version"] . '/css/fixedHeader.bootstrap.min.css"'; |
51
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-keytable-' . $plugins["keytable"]["version"] . '/css/keyTable.bootstrap.min.css"'; |
52
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-responsive-' . $plugins["responsive"]["version"] . '/css/responsive.bootstrap.min.css"'; |
53
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-rowgroup-' . $plugins["rowgroup"]["version"] . '/css/rowGroup.bootstrap.min.css"'; |
54
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-rowreorder-' . $plugins["rowreorder"]["version"] . '/css/rowReorder.bootstrap.min.css"'; |
55
|
|
|
$assets[] = 'href="/bundles/wbwjquerydatatables/datatables-select-' . $plugins["select"]["version"] . '/css/select.bootstrap.min.css"'; |
56
|
|
|
|
57
|
|
|
return $assets; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* List Javascript assets. |
62
|
|
|
* |
63
|
|
|
* @return string[] Returns the Javascript assets list. |
64
|
|
|
*/ |
65
|
|
|
public static function listJavascriptAssets(): array { |
66
|
|
|
|
67
|
|
|
$directory = realpath(__DIR__ . "/../DependencyInjection"); |
68
|
|
|
|
69
|
|
|
// Load the YAML configuration. |
70
|
|
|
$config = ConfigurationHelper::loadYamlConfig($directory, "assets"); |
71
|
|
|
$version = $config["assets"]["wbw.jquery_datatables.asset.jquery_datatables"]["version"]; |
72
|
|
|
$requires = $config["assets"]["wbw.jquery_datatables.asset.jquery_datatables"]["requires"]; |
73
|
|
|
$plugins = $config["assets"]["wbw.jquery_datatables.asset.jquery_datatables"]["plugins"]; |
74
|
|
|
|
75
|
|
|
$assets = []; |
76
|
|
|
|
77
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-' . $version . '/js/jquery.dataTables.min.js"'; |
78
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-' . $version . '/js/dataTables.bootstrap.min.js"'; |
79
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-autofill-' . $plugins["autofill"]["version"] . '/js/dataTables.autoFill.min.js"'; |
80
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-autofill-' . $plugins["autofill"]["version"] . '/js/autoFill.bootstrap.min.js"'; |
81
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-jszip-' . $requires["jszip"]["version"] . '/jszip.min.js"'; |
82
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-pdfmake-' . $requires["pdfmake"]["version"] . '/pdfmake.min.js"'; |
83
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-pdfmake-' . $requires["pdfmake"]["version"] . '/vfs_fonts.js"'; |
84
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/js/dataTables.buttons.min.js"'; |
85
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/js/buttons.colVis.min.js"'; |
86
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/js/buttons.flash.min.js"'; |
87
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/js/buttons.html5.min.js"'; |
88
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/js/buttons.print.min.js"'; |
89
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-buttons-' . $plugins["buttons"]["version"] . '/js/buttons.bootstrap.min.js"'; |
90
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-colreorder-' . $plugins["colreorder"]["version"] . '/js/dataTables.colReorder.min.js"'; |
91
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-fixedcolumns-' . $plugins["fixedcolumns"]["version"] . '/js/dataTables.fixedColumns.min.js"'; |
92
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-fixedheader-' . $plugins["fixedheader"]["version"] . '/js/dataTables.fixedHeader.min.js"'; |
93
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-keytable-' . $plugins["keytable"]["version"] . '/js/dataTables.keyTable.min.js"'; |
94
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-responsive-' . $plugins["responsive"]["version"] . '/js/dataTables.responsive.min.js"'; |
95
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-responsive-' . $plugins["responsive"]["version"] . '/js/responsive.bootstrap.min.js"'; |
96
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-rowgroup-' . $plugins["rowgroup"]["version"] . '/js/dataTables.rowGroup.min.js"'; |
97
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-rowreorder-' . $plugins["rowreorder"]["version"] . '/js/dataTables.rowReorder.min.js"'; |
98
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-scroller-' . $plugins["scroller"]["version"] . '/js/dataTables.scroller.min.js"'; |
99
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/datatables-select-' . $plugins["select"]["version"] . '/js/dataTables.select.min.js"'; |
100
|
|
|
$assets[] = 'src="/bundles/wbwjquerydatatables/editable-table/mindmup-editabletable.js"'; |
101
|
|
|
|
102
|
|
|
return $assets; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* {@inheritDoc} |
107
|
|
|
*/ |
108
|
|
|
public static function setUpBeforeClass(): void { |
109
|
|
|
parent::setUpBeforeClass(); |
110
|
|
|
|
111
|
|
|
parent::setUpSchemaTool(); |
112
|
|
|
|
113
|
|
|
// Set a default timezone. |
114
|
|
|
date_default_timezone_set("UTC"); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Set up the employee fixtures. |
119
|
|
|
* |
120
|
|
|
* @return void |
121
|
|
|
* @throws Throwable Throws an exception if an error occurs. |
122
|
|
|
*/ |
123
|
|
|
protected static function setUpEmployeeFixtures(): void { |
124
|
|
|
|
125
|
|
|
/** @var EntityManagerInterface $em */ |
126
|
|
|
$em = static::$kernel->getContainer()->get("doctrine.orm.entity_manager"); |
127
|
|
|
|
128
|
|
|
foreach (TestFixtures::getEmployees() as $entity) { |
129
|
|
|
$em->persist($entity); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
$em->flush(); |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|