forked from FriendsOfSymfony/FOSRestBundle
-
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.
* 1.8: merge branch 1.7 into 1.8 fix loading route directory resources
- Loading branch information
Showing
15 changed files
with
222 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FOS\RestBundle\Tests\Functional; | ||
|
||
/** | ||
* @author Ener-Getick <egetick@gmail.com> | ||
*/ | ||
class AllowedMethodsTest extends WebTestCase | ||
{ | ||
public function testAllowHeader() | ||
{ | ||
$client = $this->createClient(array('test_case' => 'AllowedMethodsListener')); | ||
$client->request('POST', '/allowed-methods'); | ||
$this->assertEquals('GET, LOCK, POST, PUT', $client->getResponse()->headers->get('Allow')); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Tests/Functional/Bundle/TestBundle/Controller/AllowedMethodsController.php
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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
class AllowedMethodsController | ||
{ | ||
public function indexAction() | ||
{ | ||
return new Response(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Tests/Functional/Bundle/TestBundle/Controller/Api/CommentController.php
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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\Api; | ||
|
||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
|
||
class CommentController | ||
{ | ||
public function getCommentAction($id) | ||
{ | ||
return new JsonResponse(array('id' => $id)); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Tests/Functional/Bundle/TestBundle/Controller/Api/PostController.php
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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\Api; | ||
|
||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
|
||
class PostController | ||
{ | ||
public function getPostAction($id) | ||
{ | ||
return new JsonResponse(array('id' => $id)); | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FOS\RestBundle\Tests\Functional; | ||
|
||
class RoutingTest extends WebTestCase | ||
{ | ||
private $client; | ||
|
||
public function setUp() | ||
{ | ||
$this->client = $this->createClient(array('test_case' => 'Routing')); | ||
} | ||
|
||
public function testPostControllerRoutesAreRegistered() | ||
{ | ||
$this->client->request('GET', '/posts/1'); | ||
|
||
$this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
$this->assertJsonStringEqualsJsonString('{ "id": 1 }', $this->client->getResponse()->getContent()); | ||
} | ||
|
||
public function testCommentControllerRoutesAreRegistered() | ||
{ | ||
$this->client->request('GET', '/comments/3'); | ||
|
||
$this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
$this->assertJsonStringEqualsJsonString('{ "id": 3 }', $this->client->getResponse()->getContent()); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
return array( | ||
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | ||
new \FOS\RestBundle\FOSRestBundle(), | ||
new \FOS\RestBundle\Tests\Functional\Bundle\TestBundle\TestBundle(), | ||
new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), | ||
); |
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,9 @@ | ||
imports: | ||
- { resource: ../config/default.yml } | ||
|
||
framework: | ||
serializer: | ||
enabled: true | ||
|
||
fos_rest: | ||
allowed_methods_listener: true |
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,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSRestBundle package. | ||
* | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
return array( | ||
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | ||
new \FOS\RestBundle\FOSRestBundle(), | ||
new \FOS\RestBundle\Tests\Functional\Bundle\TestBundle\TestBundle(), | ||
); |
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,9 @@ | ||
imports: | ||
- { resource: ../config/default.yml } | ||
|
||
framework: | ||
serializer: | ||
enabled: true | ||
router: { resource: "%kernel.root_dir%/Routing/routing.yml" } | ||
|
||
fos_rest: ~ |
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,3 @@ | ||
api_dir: | ||
resource: '@TestBundle/Controller/Api' | ||
type: rest |
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