Skip to content

Commit

Permalink
tests: update (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlastavesely authored and dg committed Aug 20, 2017
1 parent d56f78c commit 36d9fe7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/Forms/Forms.renderer.translate.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements ITranslator
{
public $counter = [];


public function translate($message, $count = null)
{
@$this->counter[$message]++; // @ intentionally
return strtoupper($message);
}
}


$translator = new Translator;
$form = new Form;
$form->setTranslator(new Translator);
$form->setTranslator($translator);

$form->setAction('test');
$form->addError('Login failed');
Expand All @@ -38,3 +43,17 @@ $form->addSubmit('submit', 'Send');


Assert::matchFile(__DIR__ . '/Forms.renderer.translate.expect', $form->__toString(true));


// Checking whether translation is not duplicated
Assert::same([
'Login failed' => 1,
'Weak password' => 1,
'Username' => 1,
'or email' => 1,
'Please enter your username' => 1,
'Password' => 1,
'This field is required.' => 1,
'Minimal length is %d chars' => 1,
'Send' => 1,
], $translator->counter);

0 comments on commit 36d9fe7

Please sign in to comment.