-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82320a1
commit 4b22637
Showing
13 changed files
with
143 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,9 @@ | |
|
||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Form\ChoiceList\ArrayChoiceList; | ||
use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator; | ||
use Symfony\Component\Form\ChoiceList\View\ChoiceListView; | ||
|
||
/** | ||
* @author Bernhard Schussek <[email protected]> | ||
|
@@ -38,7 +40,7 @@ protected function setUp() | |
|
||
public function testCreateFromChoicesEmpty() | ||
{ | ||
$list = new \stdClass(); | ||
$list = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createListFromChoices') | ||
|
@@ -54,7 +56,7 @@ public function testCreateFromChoicesComparesTraversableChoicesAsArray() | |
// The top-most traversable is converted to an array | ||
$choices1 = new \ArrayIterator(['A' => 'a']); | ||
$choices2 = ['A' => 'a']; | ||
$list = new \stdClass(); | ||
$list = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createListFromChoices') | ||
|
@@ -69,8 +71,8 @@ public function testCreateFromChoicesGroupedChoices() | |
{ | ||
$choices1 = ['key' => ['A' => 'a']]; | ||
$choices2 = ['A' => 'a']; | ||
$list1 = new \stdClass(); | ||
$list2 = new \stdClass(); | ||
$list1 = new ArrayChoiceList([]); | ||
$list2 = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createListFromChoices') | ||
|
@@ -92,7 +94,7 @@ public function testCreateFromChoicesSameChoices($choice1, $choice2) | |
{ | ||
$choices1 = [$choice1]; | ||
$choices2 = [$choice2]; | ||
$list = new \stdClass(); | ||
$list = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createListFromChoices') | ||
|
@@ -110,8 +112,8 @@ public function testCreateFromChoicesDifferentChoices($choice1, $choice2) | |
{ | ||
$choices1 = [$choice1]; | ||
$choices2 = [$choice2]; | ||
$list1 = new \stdClass(); | ||
$list2 = new \stdClass(); | ||
$list1 = new ArrayChoiceList([]); | ||
$list2 = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createListFromChoices') | ||
|
@@ -129,7 +131,7 @@ public function testCreateFromChoicesDifferentChoices($choice1, $choice2) | |
public function testCreateFromChoicesSameValueClosure() | ||
{ | ||
$choices = [1]; | ||
$list = new \stdClass(); | ||
$list = new ArrayChoiceList([]); | ||
$closure = function () {}; | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
|
@@ -144,8 +146,8 @@ public function testCreateFromChoicesSameValueClosure() | |
public function testCreateFromChoicesDifferentValueClosure() | ||
{ | ||
$choices = [1]; | ||
$list1 = new \stdClass(); | ||
$list2 = new \stdClass(); | ||
$list1 = new ArrayChoiceList([]); | ||
$list2 = new ArrayChoiceList([]); | ||
$closure1 = function () {}; | ||
$closure2 = function () {}; | ||
|
||
|
@@ -165,7 +167,7 @@ public function testCreateFromChoicesDifferentValueClosure() | |
public function testCreateFromLoaderSameLoader() | ||
{ | ||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock(); | ||
$list = new \stdClass(); | ||
$list = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createListFromLoader') | ||
|
@@ -180,8 +182,8 @@ public function testCreateFromLoaderDifferentLoader() | |
{ | ||
$loader1 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock(); | ||
$loader2 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock(); | ||
$list1 = new \stdClass(); | ||
$list2 = new \stdClass(); | ||
$list1 = new ArrayChoiceList([]); | ||
$list2 = new ArrayChoiceList([]); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createListFromLoader') | ||
|
@@ -199,7 +201,7 @@ public function testCreateFromLoaderDifferentLoader() | |
public function testCreateFromLoaderSameValueClosure() | ||
{ | ||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock(); | ||
$list = new \stdClass(); | ||
$list = new ArrayChoiceList([]); | ||
$closure = function () {}; | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
|
@@ -214,8 +216,8 @@ public function testCreateFromLoaderSameValueClosure() | |
public function testCreateFromLoaderDifferentValueClosure() | ||
{ | ||
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock(); | ||
$list1 = new \stdClass(); | ||
$list2 = new \stdClass(); | ||
$list1 = new ArrayChoiceList([]); | ||
$list2 = new ArrayChoiceList([]); | ||
$closure1 = function () {}; | ||
$closure2 = function () {}; | ||
|
||
|
@@ -236,7 +238,7 @@ public function testCreateViewSamePreferredChoices() | |
{ | ||
$preferred = ['a']; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -252,8 +254,8 @@ public function testCreateViewDifferentPreferredChoices() | |
$preferred1 = ['a']; | ||
$preferred2 = ['b']; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
@@ -272,7 +274,7 @@ public function testCreateViewSamePreferredChoicesClosure() | |
{ | ||
$preferred = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -288,8 +290,8 @@ public function testCreateViewDifferentPreferredChoicesClosure() | |
$preferred1 = function () {}; | ||
$preferred2 = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
@@ -308,7 +310,7 @@ public function testCreateViewSameLabelClosure() | |
{ | ||
$labels = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -324,8 +326,8 @@ public function testCreateViewDifferentLabelClosure() | |
$labels1 = function () {}; | ||
$labels2 = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
@@ -344,7 +346,7 @@ public function testCreateViewSameIndexClosure() | |
{ | ||
$index = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -360,8 +362,8 @@ public function testCreateViewDifferentIndexClosure() | |
$index1 = function () {}; | ||
$index2 = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
@@ -380,7 +382,7 @@ public function testCreateViewSameGroupByClosure() | |
{ | ||
$groupBy = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -396,8 +398,8 @@ public function testCreateViewDifferentGroupByClosure() | |
$groupBy1 = function () {}; | ||
$groupBy2 = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
@@ -416,7 +418,7 @@ public function testCreateViewSameAttributes() | |
{ | ||
$attr = ['class' => 'foobar']; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -432,8 +434,8 @@ public function testCreateViewDifferentAttributes() | |
$attr1 = ['class' => 'foobar1']; | ||
$attr2 = ['class' => 'foobar2']; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
@@ -452,7 +454,7 @@ public function testCreateViewSameAttributesClosure() | |
{ | ||
$attr = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view = new \stdClass(); | ||
$view = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->once()) | ||
->method('createView') | ||
|
@@ -468,8 +470,8 @@ public function testCreateViewDifferentAttributesClosure() | |
$attr1 = function () {}; | ||
$attr2 = function () {}; | ||
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock(); | ||
$view1 = new \stdClass(); | ||
$view2 = new \stdClass(); | ||
$view1 = new ChoiceListView(); | ||
$view2 = new ChoiceListView(); | ||
|
||
$this->decoratedFactory->expects($this->at(0)) | ||
->method('createView') | ||
|
Oops, something went wrong.