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
ae3b8a8
commit d95b106
Showing
7 changed files
with
75 additions
and
26 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace EmanueleMinotto\SimpleArrayBundle\Tests\Form\DataTransformer; | ||
|
||
use EmanueleMinotto\SimpleArrayBundle\Form\DataTransformer\SimpleArrayTransformer; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
class SimpleArrayTransformerTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var SimpleArrayTransformer | ||
*/ | ||
protected $object; | ||
|
||
public function setUp() | ||
{ | ||
$this->object = new SimpleArrayTransformer(); | ||
} | ||
|
||
public function testTransform() | ||
{ | ||
$value = range('a', 'z'); | ||
shuffle($value); | ||
|
||
$transformation = $this->object->transform($value); | ||
$this->assertSame(implode(', ', $value), $transformation); | ||
} | ||
|
||
public function testTransformNull() | ||
{ | ||
$transformation = $this->object->transform(null); | ||
$this->assertSame('', $transformation); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace EmanueleMinotto\SimpleArrayBundle\Tests\Form\Type; | ||
|
||
use EmanueleMinotto\SimpleArrayBundle\Form\Type\SimpleArrayType; | ||
use Symfony\Component\Form\Test\TypeTestCase; | ||
|
||
class SimpleArrayTypeTest extends TypeTestCase | ||
{ | ||
public function testSubmitValidData() | ||
{ | ||
$formData = [ | ||
'test' => 'test', | ||
'test2' => 'test2', | ||
]; | ||
|
||
$type = new SimpleArrayType(); | ||
$form = $this->factory->create( | ||
method_exists($type, 'getBlockPrefix') ? get_class($type) : $type | ||
); | ||
|
||
// submit the data to the form directly | ||
$form->submit($formData); | ||
|
||
$this->assertTrue($form->isSynchronized()); | ||
$this->assertEquals($formData, $form->getData()); | ||
} | ||
} |
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