Skip to content

Commit

Permalink
Merge pull request #2 from hacfi/sf3-support
Browse files Browse the repository at this point in the history
Update tests for Symfony 2.8/3.0
  • Loading branch information
Ma27 committed Feb 14, 2016
2 parents e87211b + 35398f9 commit 7c84c1a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -11,7 +11,7 @@ matrix:
- php: hhvm

env:
- SYMFONY_VERSION='2.7.*'
- SYMFONY_VERSION='2.8.*'
- SYMFONY_VERSION='3.0.*'

before_script:
Expand Down
14 changes: 5 additions & 9 deletions Tests/Form/Extension/ChoiceList/LocaleChoiceListTest.php
Expand Up @@ -95,19 +95,15 @@ public function testPreferredLocalesSorted()
->will($this->returnValue(array('de', 'nl', 'en')));

$list = new LocaleChoiceList($information);
$preferredResult = $list->getPreferredViews();
$remainingResults = $list->getRemainingViews();
$preferredResult = $list->getPreferredChoices();

$this->assertEquals('de', $preferredResult[0]->value);
$this->assertEquals('nl', $preferredResult[1]->value);
$this->assertEquals('en', $preferredResult[2]->value);

$this->assertEquals('fr', $remainingResults[0]->value);
$this->assertEquals('tr', $remainingResults[1]->value);
$this->assertEquals('de', $preferredResult[0]);
$this->assertEquals('nl', $preferredResult[1]);
$this->assertEquals('en', $preferredResult[2]);
}

public function getLocaleInformation()
{
return $this->getMockBuilder('Lunetics\LocaleBundle\LocaleInformation\LocaleInformation')->disableOriginalConstructor()->getMock();
}
}
}
12 changes: 6 additions & 6 deletions Tests/Form/Extension/Type/LocaleTypeTest.php
Expand Up @@ -16,32 +16,32 @@
*/
class LocaleTypeTest extends \PHPUnit_Framework_TestCase
{
public function testSetDefaultOptions()
public function testConfigureOptions()
{
$choiceList = $this->getMockLocaleChoiceList();

$resolver = $this->getMockOptionsResolverInterface();
$resolver
->expects($this->once())
->method('setDefaults')
->with(array('choice_list' => $choiceList));
->with(array('choices' => null, 'preferred_choices' => null));

$type = new LocaleType($choiceList);
$type->setDefaultOptions($resolver);
$type->configureOptions($resolver);
}

public function testGetParent()
{
$type = new LocaleType($this->getMockLocaleChoiceList());

$this->assertEquals('choice', $type->getParent());
$this->assertEquals('Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType', $type->getParent());
}

public function testGetName()
{
$type = new LocaleType($this->getMockLocaleChoiceList());

$this->assertEquals('lunetics_locale', $type->getName());
$this->assertEquals('lunetics_locale', $type->getBlockPrefix());
}

protected function getMockLocaleChoiceList()
Expand All @@ -57,4 +57,4 @@ protected function getMockOptionsResolverInterface()
{
return $this->getMock('Symfony\Component\OptionsResolver\OptionsResolver');
}
}
}
12 changes: 6 additions & 6 deletions composer.json
Expand Up @@ -17,16 +17,16 @@
"minimum-stability": "dev",
"require": {
"php": ">=5.5.9",
"symfony/framework-bundle": "^2.7|^3.0",
"symfony/yaml": "^2.7|^3.0",
"symfony/locale": "^2.7|^3.0",
"symfony/validator": "^2.7|^3.0",
"symfony/framework-bundle": "^2.8|^3.0",
"symfony/yaml": "^2.8|^3.0",
"symfony/locale": "^2.8|^3.0",
"symfony/validator": "^2.8|^3.0",
"psr/log": "~1.0"
},
"require-dev": {
"twig/twig": "1.*|2.*",
"ext-intl": "*",
"symfony/form": "^2.7|^3.0"
"twig/twig": "1.*|2.*",
"symfony/form": "^2.8|^3.0"
},
"suggest": {
"ext-intl": "Needed for displaying the country name in the locale language"
Expand Down

0 comments on commit 7c84c1a

Please sign in to comment.