Skip to content

Commit 22d3114

Browse files
authored
Merge pull request #72 from PHPJasper/develop
Merge pull request #71 from PHPJasper/master
2 parents d951d44 + 2e5dbab commit 22d3114

File tree

3 files changed

+39
-52
lines changed

3 files changed

+39
-52
lines changed

src/PHPJasper.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
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+
312
declare(strict_types=1);
413

514
namespace PHPJasper;
@@ -52,7 +61,7 @@ public function __construct()
5261
* @return $this
5362
* @throws Exception\InvalidInputFile
5463
*/
55-
public function compile($input, string $output = '')
64+
public function compile(string $input, string $output = '')
5665
{
5766
if ( !$input ) {
5867
throw new \PHPJasper\Exception\InvalidInputFile();

tests/PHPJasper/PHPJasperCommandTest.php

-13
This file was deleted.

tests/PHPJasper/PHPJasperTest.php

+29-38
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
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+
314
namespace PHPJasper\Test;
415

516
use PHPUnit\Framework\TestCase;
617
use PHPJasper\PHPJasper;
718

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
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

Comments
 (0)