mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-02 09:14:48 +02:00
Use [[PLACEHOLDER]] instead of %%PLACEHOLDER%% for label placeholders.
This commit is contained in:
parent
cb2d0d9845
commit
3163a7ba09
14 changed files with 80 additions and 78 deletions
|
@ -55,28 +55,28 @@ class LabelTextReplacerTest extends WebTestCase
|
|||
public function handlePlaceholderDataProvider(): array
|
||||
{
|
||||
return [
|
||||
['Part 1', '%%NAME%%'],
|
||||
['P Description', '%%DESCRIPTION%%'],
|
||||
['%%UNKNOWN%%', '%%UNKNOWN%%'],
|
||||
['%%INVALID', '%%INVALID'],
|
||||
['%%', '%%'],
|
||||
['Part 1', '[[NAME]]'],
|
||||
['P Description', '[[DESCRIPTION]]'],
|
||||
['[[UNKNOWN]]', '[[UNKNOWN]]', '[[UNKNOWN]]'],
|
||||
['[[INVALID', '[[INVALID'],
|
||||
['[[', '[['],
|
||||
['NAME', 'NAME'],
|
||||
['%%NAME', '%%NAME'],
|
||||
['Test %%NAME%%', 'Test %%NAME%%'],
|
||||
['[[NAME', '[[NAME'],
|
||||
['Test [[NAME]]', 'Test [[NAME]]', 'Test [[NAME]]'],
|
||||
];
|
||||
}
|
||||
|
||||
public function replaceDataProvider(): array
|
||||
{
|
||||
return [
|
||||
['Part 1', '%%NAME%%'],
|
||||
['TestPart 1', 'Test%%NAME%%'],
|
||||
["P Description\nPart 1", "%%DESCRIPTION_T%%\n%%NAME%%"],
|
||||
['Part 1 Part 1', '%%NAME%% %%NAME%%'],
|
||||
['%%UNKNOWN%% Test', '%%UNKNOWN%% Test'],
|
||||
["%%NAME\n%% %%NAME %%", "%%NAME\n%% %%NAME %%"],
|
||||
['%%%%', '%%%%'],
|
||||
['TEST%% %%TEST', 'TEST%% %%TEST']
|
||||
['Part 1', '[[NAME]]'],
|
||||
['TestPart 1', 'Test[[NAME]]'],
|
||||
["P Description\nPart 1", "[[DESCRIPTION_T]]\n[[NAME]]"],
|
||||
['Part 1 Part 1', '[[NAME]] [[NAME]]'],
|
||||
['[[UNKNOWN]] Test', '[[UNKNOWN]] Test'],
|
||||
["[[NAME\n]] [[NAME ]]", "[[NAME\n]] [[NAME ]]"],
|
||||
['[[]]', '[[]]'],
|
||||
['TEST[[ ]]TEST', 'TEST[[ ]]TEST']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,6 @@ class LabelTextReplacerTest extends WebTestCase
|
|||
$part->setName('Part');
|
||||
$part_lot->setPart($part);
|
||||
|
||||
$this->assertSame('Part', $this->service->handlePlaceholder('%%NAME%%', $part_lot));
|
||||
$this->assertSame('Part', $this->service->handlePlaceholder('[[NAME]]', $part_lot));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue