Skip to content

Commit e778004

Browse files
authored
Added grabParameter function (#30)
1 parent 00156b3 commit e778004

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,29 @@ public function dontSeeAuthentication($remembered = true)
10041004
);
10051005
}
10061006

1007+
/**
1008+
* Grabs a Symfony parameter
1009+
*
1010+
* ```php
1011+
* <?php
1012+
* $I->grabParameter('app.business_name');
1013+
* ```
1014+
*
1015+
* @param string $name
1016+
* @return mixed|null
1017+
*/
1018+
public function grabParameter($name)
1019+
{
1020+
$container = $this->_getContainer();
1021+
1022+
if (!$container->has('parameter_bag')) {
1023+
$this->fail("Symfony container doesn't have 'parameter_bag' service");
1024+
return null;
1025+
}
1026+
$parameterBag = $this->grabService('parameter_bag');
1027+
return $parameterBag->get($name);
1028+
}
1029+
10071030
/**
10081031
* Checks that current page matches action
10091032
*

0 commit comments

Comments
 (0)