-
Notifications
You must be signed in to change notification settings - Fork 0
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
Konstantin Wagner
committed
Mar 14, 2018
1 parent
e69f2c4
commit c885218
Showing
9 changed files
with
292 additions
and
12 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Tests\Response; | ||
|
||
use Contao\TestCase\ContaoTestCase; | ||
use HeimrichHannot\AjaxBundle\Response\Response; | ||
use HeimrichHannot\AjaxBundle\Response\Response404; | ||
|
||
class Response404Test extends ContaoTestCase | ||
{ | ||
public function testResponse() | ||
{ | ||
$response = new Response404('test'); | ||
$this->assertSame(Response::HTTP_NOT_FOUND, $response->getStatusCode()); | ||
$this->assertSame('test', $response->getMessage()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Tests\Response; | ||
|
||
use Contao\TestCase\ContaoTestCase; | ||
use HeimrichHannot\AjaxBundle\Response\ResponseData; | ||
|
||
class ResponseDataTest extends ContaoTestCase | ||
{ | ||
public function testSetGetData() | ||
{ | ||
$response = new ResponseData(); | ||
$response->setData(['data']); | ||
$this->assertSame(['data'], $response->getData()); | ||
} | ||
|
||
public function testSetGetHtml() | ||
{ | ||
$response = new ResponseData(); | ||
$response->setHtml('html'); | ||
$this->assertSame('html', $response->getHtml()); | ||
} | ||
|
||
public function testJsonSerialize() | ||
{ | ||
$response = new ResponseData('html', ['data']); | ||
$this->assertSame(['data' => ['data'], 'html' => 'html'], $response->jsonSerialize()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Tests\Response; | ||
|
||
use Contao\TestCase\ContaoTestCase; | ||
use HeimrichHannot\AjaxBundle\Response\Response; | ||
use HeimrichHannot\AjaxBundle\Response\ResponseError; | ||
|
||
class ResponseErrorTest extends ContaoTestCase | ||
{ | ||
public function testResponse() | ||
{ | ||
$response = new ResponseError('test'); | ||
$this->assertSame(Response::HTTP_BAD_REQUEST, $response->getStatusCode()); | ||
$this->assertSame('test', $response->getMessage()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Tests\Response; | ||
|
||
use Contao\TestCase\ContaoTestCase; | ||
use HeimrichHannot\AjaxBundle\Response\Response; | ||
use HeimrichHannot\AjaxBundle\Response\ResponseRedirect; | ||
|
||
class ResponseRedirectTest extends ContaoTestCase | ||
{ | ||
public function testResponse() | ||
{ | ||
$response = new ResponseRedirect('test'); | ||
$this->assertSame(Response::HTTP_MULTIPLE_CHOICES, $response->getStatusCode()); | ||
$this->assertSame('test', $response->getMessage()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (c) 2018 Heimrich & Hannot GmbH | ||
* | ||
* @license LGPL-3.0-or-later | ||
*/ | ||
|
||
namespace HeimrichHannot\AjaxBundle\Tests\Response; | ||
|
||
use Contao\TestCase\ContaoTestCase; | ||
use HeimrichHannot\AjaxBundle\Response\Response; | ||
use HeimrichHannot\AjaxBundle\Response\ResponseSuccess; | ||
|
||
class ResponseSuccessTest extends ContaoTestCase | ||
{ | ||
public function testResponse() | ||
{ | ||
$response = new ResponseSuccess('test'); | ||
$this->assertSame(Response::HTTP_OK, $response->getStatusCode()); | ||
$this->assertSame('test', $response->getMessage()); | ||
} | ||
} |