Skip to content

Commit

Permalink
FormExtractor extracts labels from create
Browse files Browse the repository at this point in the history
  • Loading branch information
Gunther Konig committed Feb 21, 2013
1 parent 1f50add commit 78d7474
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Tests/Translation/Extractor/File/Fixture/MyFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ public function buildForm(FormBuilder $builder, array $options)
'translation_domain' => 'address'
))
;
$child = $builder->create('created', 'text', array(
'label' => 'form.label.created'
))
;
}
}
4 changes: 4 additions & 0 deletions Tests/Translation/Extractor/File/FormExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public function testExtract()
$message->addSource(new FileSource($path, 47));
$expected->add($message);

$message = new Message('form.label.created');
$message->addSource(new FileSource($path, 60));
$expected->add($message);

$this->assertEquals($expected, $this->extract('MyFormType.php'));
}

Expand Down
2 changes: 1 addition & 1 deletion Translation/Extractor/File/FormExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function enterNode(\PHPParser_Node $node)
return;
}

if ('add' !== $name = strtolower($node->name)) {
if ('add' !== $name && 'create' !== $name) {
return;
}

Expand Down

0 comments on commit 78d7474

Please sign in to comment.