Skip to content

Commit 027c2ec

Browse files
authored
Merge pull request #68 from allenjd3/master
Fixed existing commented out tests
2 parents 25cf6b9 + 03ce5e0 commit 027c2ec

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
lines changed

src/PHPJasper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function __construct()
5252
* @return $this
5353
* @throws Exception\InvalidInputFile
5454
*/
55-
public function compile(string $input, string $output = '')
55+
public function compile($input, string $output = '')
5656
{
57-
if (!$input) {
57+
if ( !$input ) {
5858
throw new \PHPJasper\Exception\InvalidInputFile();
5959
}
6060

tests/PHPJasper/PHPJasperTest.php

+32-25
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ final class PHPJasperTest extends TestCase
1717
private $PHPJasper;
1818
private $input;
1919
private $output;
20+
protected $windows;
2021

2122
public function setUp()
2223
{
2324
$this->PHPJasper = new PHPJasper();
25+
$this->windows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? true : false;
2426
}
2527

2628
public function tearDown()
@@ -49,76 +51,81 @@ public function testListParameters()
4951
$this->assertEquals('jasperstarter list_parameters "{input_fille}"', $result->output());
5052
}
5153

52-
/*public function testCompileWithWrongInput()
54+
public function testCompileWithWrongInput()
5355
{
54-
$this->setExpectedExceptionFromAnnotation(\PHPJasper\Exception\InvalidInputFile::class);
55-
56-
$jasper = new PHPJasper();
57-
$jasper->compile(null);
58-
}*/
59-
/*public function testCompileWithWrongInput()
60-
{
61-
$this->setExpectedException(\PHPJasper\Exception\InvalidInputFile::class);
56+
$this->expectException(\PHPJasper\Exception\InvalidInputFile::class);
6257

6358
$jasper = new PHPJasper();
59+
6460
$jasper->compile(null);
6561
}
6662

67-
public function testCompile()
63+
public function testCompileHelloWorld()
6864
{
6965
$jasper = new PHPJasper();
66+
7067
$result = $jasper->compile('hello_world.jrxml');
7168

7269
$this->assertInstanceOf(PHPJasper::class, $result);
73-
$this->assertEquals('./jasperstarter compile "hello_world.jrxml"', $result->output());
74-
}
7570

71+
if($this->windows) {
72+
73+
$this->assertEquals('jasperstarter compile "hello_world.jrxml"', $result->output());
74+
75+
}
76+
else {
77+
78+
$this->assertEquals('./jasperstarter compile "hello_world.jrxml"', $result->output());
79+
}
80+
81+
}
82+
7683
public function testExecuteWithoutCompile()
7784
{
78-
$this->setExpectedException(\PHPJasper\Exception\InvalidCommandExecutable::class);
85+
$this->expectException(\PHPJasper\Exception\InvalidCommandExecutable::class);
7986

8087
$jasper = new PHPJasper();
8188
$jasper->execute();
8289
}
83-
90+
8491
public function testExecuteWithCompile()
8592
{
86-
$this->setExpectedException(\PHPJasper\Exception\ErrorCommandExecutable::class);
93+
$this->expectException(\PHPJasper\Exception\ErrorCommandExecutable::class);
8794

8895
$jasper = new PHPJasper();
8996
$jasper->compile('hello_world.jrxml')->execute();
9097
}
91-
98+
9299
public function testListParametersWithWrongInput()
93100
{
94-
$this->setExpectedException(\PHPJasper\Exception\InvalidInputFile::class);
101+
$this->expectException(\PHPJasper\Exception\InvalidInputFile::class);
95102

96103
$jasper = new PHPJasper();
97104
$jasper->listParameters('');
98105
}
99-
106+
100107
public function testProcessWithWrongInput()
101108
{
102-
$this->setExpectedException(\PHPJasper\Exception\InvalidInputFile::class);
109+
$this->expectException(\PHPJasper\Exception\InvalidInputFile::class);
103110

104111
$jasper = new PHPJasper();
105-
$jasper->process(0);
112+
$jasper->process(0, "");
106113
}
107-
114+
108115
public function testProcessWithWrongFormat()
109116
{
110-
$this->setExpectedException(\PHPJasper\Exception\InvalidFormat::class);
117+
$this->expectException(\PHPJasper\Exception\InvalidFormat::class);
111118

112119
$jasper = new PHPJasper();
113120
$jasper->process('hello_world.jrxml', false, [
114121
'format' => 'mp3'
115122
]);
116123
}
117-
124+
118125
public function testProcess()
119126
{
120127
$jasper = new PHPJasper();
121-
$this->assertInstanceOf(PHPJasper::class, $jasper->process('hello_world.jrxml'));
122-
}*/
128+
$this->assertInstanceOf(PHPJasper::class, $jasper->process('hello_world.jrxml', ""));
129+
}
123130

124131
}

0 commit comments

Comments
 (0)