11<?php
22
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+
314namespace PHPJasper \Test ;
415
516use PHPUnit \Framework \TestCase ;
617use PHPJasper \PHPJasper ;
718
8- final class PHPJasperTest extends TestCase
9- /**
10- * Class PHPJasperTest
11- *
12- * @author Rafael Queiroz <rafaelfqf@gmail.com>
13- * @author Daniel Rodrigues Lima ( geekcom ) <danielrodrigues-ti@hotmail.com>
14- * @package PHPJasper
15- */
16- {
17- private $ PHPJasper ;
18- private $ input ;
19- private $ output ;
20- protected $ windows ;
19+ /**
20+ * @author Rafael Queiroz <rafaelfqf@gmail.com>
21+ */
22+ class PHPJasperTest extends TestCase
2123
24+ {
2225 public function setUp ()
2326 {
2427 $ this ->PHPJasper = new PHPJasper ();
@@ -64,8 +67,8 @@ public function testCompileWithWrongInput()
6467 $ this ->expectException (\PHPJasper \Exception \InvalidInputFile::class);
6568
6669 $ jasper = new PHPJasper ();
67-
68- $ jasper ->compile (null );
70+
71+ $ jasper ->compile ('' );
6972 }
7073
7174 public function testCompileHelloWorld ()
@@ -76,26 +79,25 @@ public function testCompileHelloWorld()
7679
7780 $ this ->assertInstanceOf (PHPJasper::class, $ result );
7881
79- if ($ this ->windows ) {
82+ if ($ this ->windows ) {
8083
8184 $ this ->assertEquals ('jasperstarter compile "hello_world.jrxml" ' , $ result ->output ());
82-
83- }
84- else {
85+
86+ } else {
8587
8688 $ this ->assertEquals ('./jasperstarter compile "hello_world.jrxml" ' , $ result ->output ());
8789 }
8890
8991 }
90-
92+
9193 public function testExecuteWithoutCompile ()
9294 {
9395 $ this ->expectException (\PHPJasper \Exception \InvalidCommandExecutable::class);
9496
9597 $ jasper = new PHPJasper ();
9698 $ jasper ->execute ();
9799 }
98-
100+
99101 public function testExecuteWithCompile ()
100102 {
101103 $ this ->expectException (\PHPJasper \Exception \ErrorCommandExecutable::class);
@@ -112,41 +114,30 @@ public function testExecute()
112114 $ this ->assertInternalType ('array ' , $ actual );
113115 }
114116
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-
128117 public function testListParametersWithWrongInput ()
129118 {
130119 $ this ->expectException (\PHPJasper \Exception \InvalidInputFile::class);
131120
132121 $ jasper = new PHPJasper ();
133122 $ jasper ->listParameters ('' );
134123 }
135-
124+
136125 public function testProcessWithWrongInput ()
137126 {
138127 $ this ->expectException (\PHPJasper \Exception \InvalidInputFile::class);
139128
140129 $ jasper = new PHPJasper ();
141- $ jasper ->process (0 , "" );
130+ $ jasper ->process ('' , '' , [
131+ 'format ' => 'mp3 '
132+ ]);
142133 }
143-
134+
144135 public function testProcessWithWrongFormat ()
145136 {
146137 $ this ->expectException (\PHPJasper \Exception \InvalidFormat::class);
147138
148139 $ jasper = new PHPJasper ();
149- $ jasper ->process ('hello_world.jrxml ' , false , [
140+ $ jasper ->process ('hello_world.jrxml ' , '' , [
150141 'format ' => 'mp3 '
151142 ]);
152143 }
0 commit comments