Skip to content

Commit e40fce7

Browse files
committed
Extract a constant for the wayf_remember_choice coin name
Prior to this change, the 'wayf_remember_choice' metadata coin name was a bare string literal duplicated between the assembler's metadata path and its integration test's data provider. This change introduces a class constant on PushMetadataAssembler for that coin name and references it from both places.
1 parent 7559176 commit e40fce7

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssembler.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
*/
4747
class PushMetadataAssembler implements MetadataAssemblerInterface
4848
{
49+
public const COIN_WAYF_REMEMBER_CHOICE = 'wayf_remember_choice';
50+
4951
/**
5052
* @var ValidatorInterface
5153
*/
@@ -221,7 +223,7 @@ private function assembleSp(stdClass $connection)
221223
$properties += $this->setPathFromObjectBool([$connection, 'metadata:coin:trusted_proxy'], 'isTrustedProxy');
222224
$properties += $this->setPathFromObjectBool([$connection, 'metadata:coin:display_unconnected_idps_wayf'], 'displayUnconnectedIdpsWayf');
223225
$properties += $this->setPathFromObjectBool(
224-
[$connection, 'metadata:coin:wayf_remember_choice'],
226+
[$connection, 'metadata:coin:' . self::COIN_WAYF_REMEMBER_CHOICE],
225227
'wayfRememberChoice',
226228
strictTrueOnly: true
227229
);

‎tests/integration/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssemblerTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testCoins($coinName, $roleType, $parameter, $type)
160160

161161
switch ($type) {
162162
case 'bool':
163-
$values = $coinName === 'wayf_remember_choice'
163+
$values = $coinName === PushMetadataAssembler::COIN_WAYF_REMEMBER_CHOICE
164164
? $this->validCoinValuesBoolStrictTrueOnly()
165165
: $this->validCoinValuesBool();
166166
break;

0 commit comments

Comments
 (0)