Skip to content

Commit 85e38fd

Browse files
ISSUE-157: Renamed ArrayType to UnstructuredType
1 parent 692ee4c commit 85e38fd

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Learn more about it in its [documentation](https://github.com/darkwebdesign/symf
1515

1616
## Features
1717

18-
* ArrayType, handles unstructured array data.
1918
* BirthdayType, handles birthday data.
2019
* BooleanType, transforms an user selected value into a boolean.
2120
* EntityType, transforms an user entered identifier into a Doctrine entity.
21+
* UnstructuredType, handles unstructured data.
2222

2323
## Installing via Composer
2424

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
use Symfony\Component\OptionsResolver\OptionsResolver;
2525

2626
/**
27-
* Array form field type.
27+
* Unstructured form field type.
2828
*
2929
* @author Raymond Schouten
3030
*
3131
* @since 3.4
3232
*/
33-
class ArrayType extends AbstractType
33+
class UnstructuredType extends AbstractType
3434
{
3535
/**
3636
* Configures the options for this type.
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,36 @@
2020

2121
namespace DarkWebDesign\SymfonyAddonFormTypes\Tests;
2222

23-
use DarkWebDesign\SymfonyAddonFormTypes\ArrayType;
23+
use DarkWebDesign\SymfonyAddonFormTypes\UnstructuredType;
2424
use Symfony\Component\Form\Test\TypeTestCase;
2525

26-
class ArrayTypeTest extends TypeTestCase
26+
class UnstructuredTypeTest extends TypeTestCase
2727
{
28-
public function test()
28+
public function testArray()
2929
{
30-
$data = [
30+
$value = [
3131
'age' => 30,
3232
'name' => [
3333
'first' => 'Lawson',
3434
'last' => 'Phelps',
3535
],
3636
];
3737

38-
$form = $this->factory->create(ArrayType::class);
39-
$form->submit($data);
38+
$form = $this->factory->create(UnstructuredType::class);
39+
$form->submit($value);
4040

4141
$this->assertTrue($form->isSynchronized());
42-
$this->assertSame($data, $form->getData());
42+
$this->assertSame($value, $form->getData());
43+
}
44+
45+
public function testString()
46+
{
47+
$value = 'Monday';
48+
49+
$form = $this->factory->create(UnstructuredType::class);
50+
$form->submit($value);
51+
52+
$this->assertTrue($form->isSynchronized());
53+
$this->assertSame($value, $form->getData());
4354
}
4455
}

0 commit comments

Comments
 (0)