* added some example tests
This commit is contained in:
54
test/AppTest/Action/JcatPackageActionTest.php
Normal file
54
test/AppTest/Action/JcatPackageActionTest.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace AppTest\Action;
|
||||
|
||||
use App\Action\JcatPackageAction;
|
||||
use App\Response\JsonCorsResponse;
|
||||
use App\Service\CiExecutorService;
|
||||
use Zend\Diactoros\Response;
|
||||
use Zend\Diactoros\ServerRequest;
|
||||
|
||||
class JcatPackageActionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $testJcatVersions = [
|
||||
"TSP_JCAT-138.3",
|
||||
"TSP_JCAT-138.2",
|
||||
"TSP_JCAT-138.1_TSPBUG-10203",
|
||||
"TSP_JCAT-138.1",
|
||||
"TSP_JCAT-138.0_CORE",
|
||||
"TSP_JCAT-138.0_COMMON",
|
||||
"TSP_JCAT-138.0",
|
||||
];
|
||||
|
||||
/** @var CiExecutorService */
|
||||
protected $ciExecutorService;
|
||||
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->ciExecutorService = $this->prophesize(CiExecutorService::class);
|
||||
$this->ciExecutorService->getJcatPackages()->willReturn($this->testJcatVersions);
|
||||
}
|
||||
|
||||
public function testResponse()
|
||||
{
|
||||
$ciConfigPage = new JcatPackageAction($this->ciExecutorService->reveal());
|
||||
$response = $ciConfigPage(new ServerRequest(), new Response(), function () {
|
||||
});
|
||||
|
||||
$this->assertTrue($response instanceof Response);
|
||||
}
|
||||
|
||||
public function testGetList()
|
||||
{
|
||||
$ciConfigPage = new JcatPackageAction($this->ciExecutorService->reveal());
|
||||
$response = $ciConfigPage(new ServerRequest(), new Response(), function () {
|
||||
});
|
||||
|
||||
$this->assertTrue($response instanceof JsonCorsResponse);
|
||||
|
||||
$json = json_decode((string) $response->getBody());
|
||||
$this->assertTrue(is_array($json));
|
||||
$this->assertTrue($json == $this->testJcatVersions);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user