'subdir1' =>
[ 'plugin1.yml' => "id: plugin1\ntest_provider: module_a\ntitle: 'test title'",
'plugin2.yml' => "id: plugin2\ntest_provider: module_a\ntitle: 'test title'\ntitle_context: test-context",
],
],
]);
$directories =
[ 'module_a' => vfsStream::
url('modules/module_a/subdir1'
),
];
$discovery =
new YamlDirectoryDiscovery($directories, 'test'
);
$discovery->
addTranslatableProperty('title', 'title_context'
);
$definitions =
$discovery->
getDefinitions();
$this->
assertCount(2,
$definitions);
$plugin_1 =
$definitions['plugin1'
];
$plugin_2 =
$definitions['plugin2'
];
$this->
assertInstanceOf(TranslatableMarkup::
class,
$plugin_1['title'
]);
$this->
assertEquals([],
$plugin_1['title'
]->
getOptions());
$this->
assertInstanceOf(TranslatableMarkup::
class,
$plugin_2['title'
]);
$this->
assertEquals(['context' => 'test-context'
],
$plugin_2['title'
]->
getOptions());
}}