Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Moved deprecation notice triggers to file level #14201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Form] Removed remaining deprecation notices in the test suite
  • Loading branch information
webmozart committed Apr 8, 2015
commit de460b9e7d78c44f351eec1bd1cfa0ad591e242d
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,9 @@ function ($object, $key, $value) {
$this->assertFlatViewWithAttr($view);
}

/**
* @group legacy
*/
public function testCreateViewForLegacyChoiceList()
{
$preferred = array(new ChoiceView('Preferred', 'x', 'x'));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList\Fixtures;

use Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList;

class LazyChoiceListImpl extends LazyChoiceList
{
private $choiceList;

public function __construct($choiceList)
{
$this->choiceList = $choiceList;
}

protected function loadChoiceList()
{
return $this->choiceList;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList\Fixtures;

use Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList;

class LazyChoiceListInvalidImpl extends LazyChoiceList
{
protected function loadChoiceList()
{
return new \stdClass();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,25 @@
namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList;

use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
use Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
use Symfony\Component\Form\Tests\Extension\Core\ChoiceList\Fixtures\LazyChoiceListImpl;
use Symfony\Component\Form\Tests\Extension\Core\ChoiceList\Fixtures\LazyChoiceListInvalidImpl;

/**
* @group legacy
*/
class LazyChoiceListTest extends \PHPUnit_Framework_TestCase
{
/**
* @var LazyChoiceListTest_Impl
* @var LazyChoiceListImpl
*/
private $list;

protected function setUp()
{
parent::setUp();

$this->list = new LazyChoiceListTest_Impl(new SimpleChoiceList(array(
$this->list = new LazyChoiceListImpl(new SimpleChoiceList(array(
'a' => 'A',
'b' => 'B',
'c' => 'C',
Expand Down Expand Up @@ -92,31 +93,8 @@ public function testGetValuesForChoices()
*/
public function testLoadChoiceListShouldReturnChoiceList()
{
$list = new LazyChoiceListTest_InvalidImpl();
$list = new LazyChoiceListInvalidImpl();

$list->getChoices();
}
}

class LazyChoiceListTest_Impl extends LazyChoiceList
{
private $choiceList;

public function __construct($choiceList)
{
$this->choiceList = $choiceList;
}

protected function loadChoiceList()
{
return $this->choiceList;
}
}

class LazyChoiceListTest_InvalidImpl extends LazyChoiceList
{
protected function loadChoiceList()
{
return new \stdClass();
}
}