diff --git a/Tests/Application/config/config.yml b/Tests/Application/config/config.yml
index 682c6b8..af8cf11 100644
--- a/Tests/Application/config/config.yml
+++ b/Tests/Application/config/config.yml
@@ -1 +1,4 @@
+framework:
+ router: { resource: "%kernel.project_dir%/config/routing.yml" }
+
doctrine:
\ No newline at end of file
diff --git a/Tests/Application/config/templates/pages/overview.html.twig b/Tests/Application/config/templates/pages/overview.html.twig
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/Application/config/webspaces/newsbundle.xml b/Tests/Application/config/webspaces/newsbundle.xml
new file mode 100644
index 0000000..7675bdc
--- /dev/null
+++ b/Tests/Application/config/webspaces/newsbundle.xml
@@ -0,0 +1,54 @@
+
+
+
+ TheCadien NewsBundle
+ newsbundle
+
+
+
+
+
+ default
+
+
+ overview
+ overview
+
+
+
+
+
+
+ Mainnavigation
+
+
+
+
+
+
+
+ TheCadien NewsBundle
+ newsbundle.de
+
+
+
+
+ {host}
+
+
+
+
+ {host}
+
+
+
+
+ {host}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tests/Functional/Controller/Admin/NewsControllerTest.php b/Tests/Functional/Controller/Admin/NewsControllerTest.php
index 2286677..c512697 100644
--- a/Tests/Functional/Controller/Admin/NewsControllerTest.php
+++ b/Tests/Functional/Controller/Admin/NewsControllerTest.php
@@ -3,15 +3,44 @@
namespace Functional\Controller\Admin;
use Sulu\Bundle\TestBundle\Testing\SuluTestCase;
+use TheCadien\Bundle\SuluNewsBundle\Tests\Unit\Traits\Api\NewsTrait;
class NewsControllerTest extends SuluTestCase
{
+ use NewsTrait;
+
public function testAppGetNews()
{
- $client = static::createAuthenticatedClient();
- $client->request('get', '/admin/api/news/1');
+ $client = self::createAuthenticatedClient();
+
+ self::purgeDatabase();
+ $news = $this->generateNews();
+
+ $newsRepository = $client->getContainer()->get('TheCadien\Bundle\SuluNewsBundle\Repository\NewsRepository');
+ $newsRepository->save($news);
+
+ $client->request('GET', '/admin/api/news/' . $news->getId() . '?locale=en');
+
+ $response = json_decode($client->getResponse()->getContent());
+
+ self::assertSame('Test Teaser', $response->teaser);
+ self::assertSame('title', $response->content[0]->type);
+ self::assertSame('Test', $response->content[0]->title);
+ self::assertSame('/test-1', $response->route);
+ self::assertTrue($response->enabled);
+ self::assertSame([], $response->tags); //todo Test with tags!
+ self::assertNull($response->author); //todo ! Test Author!
+ self::assertNull($response->ext); //todo ! Test ext!
+
+ }
+
+ public function testAppGetNewsWithoutData()
+ {
+ $client = self::createAuthenticatedClient();
+
+ self::purgeDatabase();
- $response = $client->getResponse();
- self::assertSame('hi', 'hi');
+ $client->request('GET', '/admin/api/news/1000?locale=en');
+ self::assertResponseStatusCodeSame(404);
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 8bd9228..8cec0b3 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -17,5 +17,6 @@
+