-
Notifications
You must be signed in to change notification settings - Fork 19
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
Showing
7 changed files
with
128 additions
and
10 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
49 changes: 49 additions & 0 deletions
49
Tests/Unit/DependencyInjection/Compiler/SettingsFormPassTest.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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Sulu. | ||
* | ||
* (c) Sulu GmbH | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Sulu\Bundle\ContentBundle\Tests\Unit\DependencyInjection\Compiler; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sulu\Bundle\ContentBundle\Content\Domain\Model\AuthorInterface; | ||
use Sulu\Bundle\ContentBundle\Content\Domain\Model\SeoInterface; | ||
use Sulu\Bundle\ContentBundle\DependencyInjection\Compiler\SettingsFormPass; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class SettingsFormPassTest extends TestCase | ||
{ | ||
public function testProcess(): void | ||
{ | ||
$directories = [ | ||
__DIR__ . \DIRECTORY_SEPARATOR . 'SettingsFormXml', | ||
]; | ||
|
||
$container = $this->prophesize(ContainerBuilder::class); | ||
$container->getParameter('sulu_admin.forms.directories') | ||
->shouldBeCalled() | ||
->willReturn($directories); | ||
|
||
$container->setParameter('sulu_content.settings_forms', [ | ||
'content_settings_seo' => [ | ||
'instanceOf' => SeoInterface::class, | ||
'priority' => 256, | ||
], | ||
'content_settings_author' => [ | ||
'instanceOf' => AuthorInterface::class, | ||
'priority' => 128, | ||
], | ||
])->shouldBeCalled(); | ||
|
||
$settingsFormPass = new SettingsFormPass(); | ||
$settingsFormPass->process($container->reveal()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Tests/Unit/DependencyInjection/Compiler/SettingsFormXml/content_settings_author.xml
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,29 @@ | ||
<?xml version="1.0" ?> | ||
<form xmlns="http://schemas.sulu.io/template/template" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd" | ||
> | ||
<key>content_settings_author</key> | ||
|
||
<tag name="content_settings_author" instanceOf="Sulu\Bundle\ContentBundle\Content\Domain\Model\AuthorInterface" priority="128"/> | ||
|
||
<properties> | ||
<section name="author"> | ||
<meta> | ||
<title>sulu_content.author</title> | ||
</meta> | ||
<properties> | ||
<property name="authored" type="datetime" colspan="6"> | ||
<meta> | ||
<title>sulu_content.authored_date</title> | ||
</meta> | ||
</property> | ||
<property name="author" type="single_contact_selection" colspan="6"> | ||
<meta> | ||
<title>sulu_content.author</title> | ||
</meta> | ||
</property> | ||
</properties> | ||
</section> | ||
</properties> | ||
</form> |
12 changes: 12 additions & 0 deletions
12
Tests/Unit/DependencyInjection/Compiler/SettingsFormXml/content_settings_no_interface.xml
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,12 @@ | ||
<?xml version="1.0" ?> | ||
<form xmlns="http://schemas.sulu.io/template/template" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd" | ||
> | ||
<key>content_settings_no_interface</key> | ||
|
||
<tag name="content_settings_no_interface" priority="64"/> | ||
|
||
<properties> | ||
</properties> | ||
</form> |
10 changes: 10 additions & 0 deletions
10
Tests/Unit/DependencyInjection/Compiler/SettingsFormXml/content_settings_no_tag.xml
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,10 @@ | ||
<?xml version="1.0" ?> | ||
<form xmlns="http://schemas.sulu.io/template/template" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd" | ||
> | ||
<key>content_settings_no_tag</key> | ||
|
||
<properties> | ||
</properties> | ||
</form> |
12 changes: 12 additions & 0 deletions
12
Tests/Unit/DependencyInjection/Compiler/SettingsFormXml/content_settings_seo.xml
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,12 @@ | ||
<?xml version="1.0" ?> | ||
<form xmlns="http://schemas.sulu.io/template/template" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd" | ||
> | ||
<key>content_settings_seo</key> | ||
|
||
<tag name="content_settings_seo" instanceOf="Sulu\Bundle\ContentBundle\Content\Domain\Model\SeoInterface" priority="256"/> | ||
|
||
<properties> | ||
</properties> | ||
</form> |