public function testOrder() { $form = $this->factory->create(FormType::class)->add('firstName', TextType::class)->add('secondName', TextType::class); $resolver = new Resolver(); $resolver->addTransformer('text', new StringTransformer()); $transformer = new CompoundTransformer($resolver); $transformed = $transformer->transform($form); $this->assertTrue(is_array($transformed)); $this->assertEquals(1, $transformed['properties']['firstName']['propertyOrder']); $this->assertEquals(2, $transformed['properties']['secondName']['propertyOrder']); }
public function testRequired() { $form = $this->factory->create(FormType::class)->add('firstName', TextType::class, ['required' => true]); $resolver = new Resolver(); $resolver->addTransformer('text', new StringTransformer()); $transformer = new CompoundTransformer($resolver); $transformed = $transformer->transform($form); $this->assertTrue(is_array($transformed)); $this->assertArrayHasKey('required', $transformed); $this->assertTrue(is_array($transformed['required'])); $this->assertContains('firstName', $transformed['required']); }