1
1
<?php
2
2
3
+ /*
4
+ * This file is part of the PHPJasper.
5
+ *
6
+ * (c) Daniel Rodrigues (geekcom)
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
+ declare (strict_types=1 );
13
+
3
14
namespace PHPJasper \Test ;
4
15
5
16
use PHPUnit \Framework \TestCase ;
6
17
use PHPJasper \PHPJasper ;
7
18
8
- final class PHPJasperTest extends TestCase
9
- /**
10
- * Class PHPJasperTest
11
- *
12
- * @author Rafael Queiroz <[email protected] >
13
- * @author Daniel Rodrigues Lima ( geekcom ) <[email protected] >
14
- * @package PHPJasper
15
- */
16
- {
17
- private $ PHPJasper ;
18
- private $ input ;
19
- private $ output ;
20
- protected $ windows ;
19
+ /**
20
+ * @author Rafael Queiroz <[email protected] >
21
+ */
22
+ class PHPJasperTest extends TestCase
21
23
24
+ {
22
25
public function setUp ()
23
26
{
24
27
$ this ->PHPJasper = new PHPJasper ();
@@ -64,8 +67,8 @@ public function testCompileWithWrongInput()
64
67
$ this ->expectException (\PHPJasper \Exception \InvalidInputFile::class);
65
68
66
69
$ jasper = new PHPJasper ();
67
-
68
- $ jasper ->compile (null );
70
+
71
+ $ jasper ->compile ('' );
69
72
}
70
73
71
74
public function testCompileHelloWorld ()
@@ -76,26 +79,25 @@ public function testCompileHelloWorld()
76
79
77
80
$ this ->assertInstanceOf (PHPJasper::class, $ result );
78
81
79
- if ($ this ->windows ) {
82
+ if ($ this ->windows ) {
80
83
81
84
$ this ->assertEquals ('jasperstarter compile "hello_world.jrxml" ' , $ result ->output ());
82
-
83
- }
84
- else {
85
+
86
+ } else {
85
87
86
88
$ this ->assertEquals ('./jasperstarter compile "hello_world.jrxml" ' , $ result ->output ());
87
89
}
88
90
89
91
}
90
-
92
+
91
93
public function testExecuteWithoutCompile ()
92
94
{
93
95
$ this ->expectException (\PHPJasper \Exception \InvalidCommandExecutable::class);
94
96
95
97
$ jasper = new PHPJasper ();
96
98
$ jasper ->execute ();
97
99
}
98
-
100
+
99
101
public function testExecuteWithCompile ()
100
102
{
101
103
$ this ->expectException (\PHPJasper \Exception \ErrorCommandExecutable::class);
@@ -112,41 +114,30 @@ public function testExecute()
112
114
$ this ->assertInternalType ('array ' , $ actual );
113
115
}
114
116
115
- public function testResourceDirectoryException ()
116
- {
117
- $ this ->expectException (\PHPJasper \Exception \InvalidResourceDirectory::class);
118
-
119
- $ jasper = new PHPJasper ();
120
- $ jasperReflection = new \ReflectionClass (get_class ($ jasper ));
121
- $ property = $ jasperReflection ->getProperty ('pathExecutable ' );
122
- $ property ->setAccessible (true );
123
- $ property ->setValue ($ jasper ,'' );
124
-
125
- $ jasper ->compile (__DIR__ . '/test.jrxml ' )->execute ();
126
- }
127
-
128
117
public function testListParametersWithWrongInput ()
129
118
{
130
119
$ this ->expectException (\PHPJasper \Exception \InvalidInputFile::class);
131
120
132
121
$ jasper = new PHPJasper ();
133
122
$ jasper ->listParameters ('' );
134
123
}
135
-
124
+
136
125
public function testProcessWithWrongInput ()
137
126
{
138
127
$ this ->expectException (\PHPJasper \Exception \InvalidInputFile::class);
139
128
140
129
$ jasper = new PHPJasper ();
141
- $ jasper ->process (0 , "" );
130
+ $ jasper ->process ('' , '' , [
131
+ 'format ' => 'mp3 '
132
+ ]);
142
133
}
143
-
134
+
144
135
public function testProcessWithWrongFormat ()
145
136
{
146
137
$ this ->expectException (\PHPJasper \Exception \InvalidFormat::class);
147
138
148
139
$ jasper = new PHPJasper ();
149
- $ jasper ->process ('hello_world.jrxml ' , false , [
140
+ $ jasper ->process ('hello_world.jrxml ' , '' , [
150
141
'format ' => 'mp3 '
151
142
]);
152
143
}
0 commit comments