-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the PHPJasper. | ||
* | ||
* (c) Daniel Rodrigues (geekcom) | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PHPJasper\Test; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PHPJasper\PHPJasper; | ||
|
||
final class PHPJasperTest extends TestCase | ||
/** | ||
* Class PHPJasperTest | ||
* | ||
* @author Rafael Queiroz <[email protected]> | ||
* @author Daniel Rodrigues Lima ( geekcom ) <[email protected]> | ||
* @package PHPJasper | ||
*/ | ||
{ | ||
private $PHPJasper; | ||
private $input; | ||
private $output; | ||
protected $windows; | ||
/** | ||
* @author Rafael Queiroz <[email protected]> | ||
*/ | ||
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,26 +79,25 @@ 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); | ||
|
||
$jasper = new PHPJasper(); | ||
$jasper->execute(); | ||
} | ||
|
||
public function testExecuteWithCompile() | ||
{ | ||
$this->expectException(\PHPJasper\Exception\ErrorCommandExecutable::class); | ||
|
@@ -112,41 +114,30 @@ 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); | ||
|
||
$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' | ||
]); | ||
} | ||
|