From 2e5dbabecc1993f3eaf36181eb7588545722cea6 Mon Sep 17 00:00:00 2001 From: "Daniel Rodrigues (geekcom)" Date: Tue, 10 Oct 2017 16:49:14 -0300 Subject: [PATCH] general improvements --- src/PHPJasper.php | 11 +++- tests/PHPJasper/PHPJasperCommandTest.php | 13 ----- tests/PHPJasper/PHPJasperTest.php | 67 ++++++++++-------------- 3 files changed, 39 insertions(+), 52 deletions(-) delete mode 100644 tests/PHPJasper/PHPJasperCommandTest.php diff --git a/src/PHPJasper.php b/src/PHPJasper.php index 3614000..ef20eff 100644 --- a/src/PHPJasper.php +++ b/src/PHPJasper.php @@ -1,5 +1,14 @@ assertNull(null); - } -} \ No newline at end of file diff --git a/tests/PHPJasper/PHPJasperTest.php b/tests/PHPJasper/PHPJasperTest.php index 1bc2f5a..001d59f 100644 --- a/tests/PHPJasper/PHPJasperTest.php +++ b/tests/PHPJasper/PHPJasperTest.php @@ -1,24 +1,27 @@ - * @author Daniel Rodrigues Lima ( geekcom ) - * @package PHPJasper - */ -{ - private $PHPJasper; - private $input; - private $output; - protected $windows; +/** + * @author Rafael Queiroz + */ +class PHPJasperTest extends TestCase +{ public function setUp() { $this->PHPJasper = new PHPJasper(); @@ -64,8 +67,8 @@ public function testCompileWithWrongInput() $this->expectException(\PHPJasper\Exception\InvalidInputFile::class); $jasper = new PHPJasper(); - - $jasper->compile(null); + + $jasper->compile(''); } public function testCompileHelloWorld() @@ -76,18 +79,17 @@ public function testCompileHelloWorld() $this->assertInstanceOf(PHPJasper::class, $result); - if($this->windows) { + if ($this->windows) { $this->assertEquals('jasperstarter compile "hello_world.jrxml"', $result->output()); - - } - else { + + } else { $this->assertEquals('./jasperstarter compile "hello_world.jrxml"', $result->output()); } } - + public function testExecuteWithoutCompile() { $this->expectException(\PHPJasper\Exception\InvalidCommandExecutable::class); @@ -95,7 +97,7 @@ public function testExecuteWithoutCompile() $jasper = new PHPJasper(); $jasper->execute(); } - + public function testExecuteWithCompile() { $this->expectException(\PHPJasper\Exception\ErrorCommandExecutable::class); @@ -112,19 +114,6 @@ public function testExecute() $this->assertInternalType('array', $actual); } - public function testResourceDirectoryException() - { - $this->expectException(\PHPJasper\Exception\InvalidResourceDirectory::class); - - $jasper = new PHPJasper(); - $jasperReflection = new \ReflectionClass(get_class($jasper)); - $property = $jasperReflection->getProperty('pathExecutable'); - $property->setAccessible(true); - $property->setValue($jasper,''); - - $jasper->compile(__DIR__ . '/test.jrxml')->execute(); - } - public function testListParametersWithWrongInput() { $this->expectException(\PHPJasper\Exception\InvalidInputFile::class); @@ -132,21 +121,23 @@ public function testListParametersWithWrongInput() $jasper = new PHPJasper(); $jasper->listParameters(''); } - + public function testProcessWithWrongInput() { $this->expectException(\PHPJasper\Exception\InvalidInputFile::class); $jasper = new PHPJasper(); - $jasper->process(0, ""); + $jasper->process('', '', [ + 'format' => 'mp3' + ]); } - + public function testProcessWithWrongFormat() { $this->expectException(\PHPJasper\Exception\InvalidFormat::class); $jasper = new PHPJasper(); - $jasper->process('hello_world.jrxml', false, [ + $jasper->process('hello_world.jrxml', '', [ 'format' => 'mp3' ]); }