Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 240ff7e

Browse files
committed
Fix
1 parent 2c86122 commit 240ff7e

File tree

8 files changed

+119
-43
lines changed

8 files changed

+119
-43
lines changed

tests/App/AppKernel.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@
1414
namespace Sonata\NewsBundle\Tests\App;
1515

1616
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
17+
use FOS\RestBundle\FOSRestBundle;
1718
use JMS\SerializerBundle\JMSSerializerBundle;
19+
use Knp\Bundle\MarkdownBundle\KnpMarkdownBundle;
1820
use Knp\Bundle\MenuBundle\KnpMenuBundle;
1921
use Nelmio\ApiDocBundle\Annotation\Operation;
2022
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
2123
use Sonata\BlockBundle\SonataBlockBundle;
2224
use Sonata\ClassificationBundle\SonataClassificationBundle;
2325
use Sonata\Doctrine\Bridge\Symfony\SonataDoctrineBundle;
2426
use Sonata\Form\Bridge\Symfony\SonataFormBundle;
27+
use Sonata\FormatterBundle\SonataFormatterBundle;
2528
use Sonata\IntlBundle\SonataIntlBundle;
2629
use Sonata\MediaBundle\SonataMediaBundle;
2730
use Sonata\NewsBundle\SonataNewsBundle;
@@ -52,16 +55,19 @@ public function __construct()
5255
public function registerBundles(): iterable
5356
{
5457
return [
58+
new FOSRestBundle(),
5559
new FrameworkBundle(),
5660
new TwigBundle(),
5761
new SecurityBundle(),
5862
new DoctrineBundle(),
63+
new KnpMarkdownBundle(),
5964
new KnpMenuBundle(),
6065
new SonataBlockBundle(),
6166
new SonataDoctrineBundle(),
6267
new SonataFormBundle(),
6368
new SonataTwigBundle(),
6469
new SonataClassificationBundle(),
70+
new SonataFormatterBundle(),
6571
new SonataIntlBundle(),
6672
new SonataMediaBundle(),
6773
new SonataNewsBundle(),
@@ -88,21 +94,23 @@ public function getProjectDir()
8894

8995
protected function configureRoutes(RouteCollectionBuilder $routes): void
9096
{
97+
$routes->import(__DIR__.'/Resources/config/routing/routes.yaml', '/', 'yaml');
98+
9199
if (class_exists(Operation::class)) {
92-
$routes->import(__DIR__.'/routes/api_nelmio_v3.yml', '/', 'yaml');
100+
$routes->import(__DIR__.'/Resources/config/routing/api_nelmio_v3.yml', '/', 'yaml');
93101
} else {
94-
$routes->import(__DIR__.'/routes/api_nelmio_v2.yml', '/', 'yaml');
102+
$routes->import(__DIR__.'/Resources/config/routing/api_nelmio_v2.yml', '/', 'yaml');
95103
}
96104
}
97105

98106
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
99107
{
100-
$loader->load($this->getProjectDir().'/config/config.yaml');
108+
$loader->load($this->getProjectDir().'/Resources/config/config.yaml');
101109
$containerBuilder->setParameter('app.base_dir', $this->getBaseDir());
102110
}
103111

104112
private function getBaseDir(): string
105113
{
106-
return sys_get_temp_dir().'/sonata-news-bundle/var/';
114+
return sys_get_temp_dir().'/sonata-news-bundle/var/dase12r1aa23r213';
107115
}
108116
}

tests/App/config/config.yaml tests/App/Resources/config/config.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ twig:
2323
paths:
2424
- '%kernel.project_dir%/Resources/views'
2525
strict_variables: '%kernel.debug%'
26+
form_themes:
27+
- '@SonataFormatter/Form/formatter.html.twig'
28+
29+
fos_rest:
30+
param_fetcher_listener: true
31+
body_listener: true
32+
format_listener:
33+
enabled: true
34+
rules:
35+
priorities: 'json'
36+
fallback_format: 'json'
37+
prefer_extension: false
38+
view:
39+
view_response_listener: true
40+
body_converter:
41+
enabled: false
42+
validate: true
2643

2744
doctrine:
2845
dbal:

tests/App/config/routes.yaml tests/App/Resources/config/routing/api_nelmio_v2.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ NelmioApiDocBundle:
22
prefix: /api/doc
33
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
44

5-
sonata_api_news:
5+
sonata_api_classification:
66
prefix: /api/news
77
resource: "@SonataNewsBundle/Resources/config/routing/api.xml"
8-
9-
test_page:
10-
path: /u_truncate_test
11-
controller: Sonata\NewsBundle\Tests\App\Controller\TruncateController:test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
app.swagger:
2+
path: /api/doc.json
3+
methods: GET
4+
defaults: {_controller: nelmio_api_doc.controller.swagger}
5+
6+
app.swagger_ui:
7+
path: /api/doc
8+
methods: GET
9+
defaults: {_controller: nelmio_api_doc.controller.swagger_ui}
10+
11+
sonata_api_classification:
12+
prefix: /api/news
13+
resource: "@SonataNewsBundle/Resources/config/routing/api_nelmio_v3.xml"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test_page:
2+
path: /u_truncate_test
3+
controller: Sonata\NewsBundle\Tests\App\Controller\TruncateController:test
File renamed without changes.
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
sonata_news:
2+
title: Sonata Project
3+
link: https://sonata-project.org
4+
description: Cool bundles on top of Symfony2
5+
salt: 'secureToken'
6+
permalink_generator: sonata.news.permalink.date
7+
db_driver: 'doctrine_orm'
8+
comment:
9+
notification:
10+
emails: [email@example.org, email2@example.org]
11+
from: no-reply@sonata-project.org
12+
template: '@SonataNews/Mail/comment_notification.txt.twig'
13+
14+
sonata_media:
15+
db_driver: 'doctrine_orm'
16+
default_context: default
17+
contexts:
18+
default:
19+
providers:
20+
- sonata.media.provider.dailymotion
21+
- sonata.media.provider.youtube
22+
- sonata.media.provider.image
23+
- sonata.media.provider.file
24+
- sonata.media.provider.vimeo
25+
formats:
26+
small: {width: 100, quality: 70}
27+
big: {width: 500, quality: 70}
28+
cdn:
29+
server:
30+
path: /uploads/media
31+
filesystem:
32+
local:
33+
directory: '%kernel.root_dir%/../public/uploads/media'
34+
create: false
35+
36+
sonata_formatter:
37+
default_formatter: text
38+
formatters:
39+
markdown:
40+
service: sonata.formatter.text.markdown
41+
extensions:
42+
- sonata.formatter.twig.control_flow
43+
- sonata.formatter.twig.gist
44+
# - sonata.media.formatter.twig #keep this commented unless you are using media bundle.
45+
46+
47+
text:
48+
service: sonata.formatter.text.text
49+
extensions:
50+
- sonata.formatter.twig.control_flow
51+
- sonata.formatter.twig.gist
52+
# - sonata.media.formatter.twig
53+
54+
55+
rawhtml:
56+
service: sonata.formatter.text.raw
57+
extensions:
58+
- sonata.formatter.twig.control_flow
59+
- sonata.formatter.twig.gist
60+
# - sonata.media.formatter.twig
61+
62+
63+
richhtml:
64+
service: sonata.formatter.text.raw
65+
extensions:
66+
- sonata.formatter.twig.control_flow
67+
- sonata.formatter.twig.gist
68+
# - sonata.media.formatter.twig
69+
70+
71+
twig:
72+
service: sonata.formatter.text.twigengine
73+
extensions: [] # Twig formatter cannot have extensions

tests/App/config/sonata.yaml

-34
This file was deleted.

0 commit comments

Comments
 (0)