Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle][Console] Add parameter descriptors#10370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
[FrameworkBundle][Test] Add parameter descriptor tests
  • Loading branch information
@inelgnu
inelgnu committedMar 27, 2014
commitfd200d591a23a9d224c8ae4b6a8e1eafffe549e8
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,17 +114,6 @@ abstract protected function describeRouteCollection(RouteCollection $routes, arr
*/
abstract protected function describeRoute(Route $route, array $options = array());

/**
* Describes a specific container parameter.
*
* @param mixed $parameterValue
* @param array $options
*/
protected function describeContainerParameter($parameterValue, array $options = array())
{
$this->write($this->formatParameter($parameterValue));
}

/**
* Describes container parameters.
*
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -212,7 +212,7 @@ protected function describeContainerAlias(Alias $alias, array $options = array()
*/
protected function describeContainerParameter($parameter, array $options = array())
{
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n%s", $options['parameter'], str_repeat('~', strlen($options['parameter'])), $this->formatParameter($parameter)): $parameter);
$this->write(isset($options['parameter']) ? sprintf("%s\n%s\n\n%s", $options['parameter'], str_repeat('=', strlen($options['parameter'])), $this->formatParameter($parameter)): $parameter);
}

private function formatRouterConfig(array $array)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -385,7 +385,7 @@ private function getContainerParameterDocument($parameter, $options = array())
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($parameterXML = $dom->createElement('parameter'));

if (isset($options['parameter'])) {
if (isset($options['parameter'])) {
$parameterXML->setAttribute('key', $options['parameter']);
}

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -87,6 +87,21 @@ public function getDescribeContainerAliasTestData()
return $this->getDescriptionTestData(ObjectsProvider::getContainerAliases());
}

/** @dataProvider getDescribeContainerParameterTestData */
public function testDescribeContainerParameter($parameter, $expectedDescription, array $options)
{
$this->assertDescription($expectedDescription, $parameter, $options);
}

public function getDescribeContainerParameterTestData()
{
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());

array_push($data[0], array('parameter' => 'database_name'));

return $data;
}

abstract protected function getDescriptor();
abstract protected function getFormat();

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,6 +66,16 @@ public static function getContainerParameters()
);
}

public static function getContainerParameter()
{
$builder = new ContainerBuilder();
$builder->setParameter('database_name', 'symfony');

return array(
'parameter' => $builder
);
}

public static function getContainerBuilders()
{
$builder1 = new ContainerBuilder();
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
{
"database_name": "symfony"
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
database_name
=============

symfony
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
symfony
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<parameter key="database_name">symfony</parameter>

[8]ページ先頭

©2009-2025 Movatter.jp