How to use getData method of data class

Best Atoum code snippet using data.getData

ChoiceTypeTest.php

Source:ChoiceTypeTest.php Github

copy

Full Screen

...189 'expanded' => false,190 'choices' => $this->choices,191 ));192 $form->submit('b');193 $this->assertEquals('b', $form->getData());194 $this->assertEquals('b', $form->getViewData());195 }196 public function testSubmitSingleNonExpandedInvalidChoice()197 {198 $form = $this->factory->create('choice', null, array(199 'multiple' => false,200 'expanded' => false,201 'choices' => $this->choices,202 ));203 $form->submit('foobar');204 $this->assertNull($form->getData());205 $this->assertEquals('foobar', $form->getViewData());206 $this->assertFalse($form->isSynchronized());207 }208 public function testSubmitSingleNonExpandedObjectChoices()209 {210 $form = $this->factory->create('choice', null, array(211 'multiple' => false,212 'expanded' => false,213 'choice_list' => new ObjectChoiceList(214 $this->objectChoices,215 // label path216 'name',217 array(),218 null,219 // value path220 'id'221 ),222 ));223 // "id" value of the second entry224 $form->submit('2');225 $this->assertEquals($this->objectChoices[1], $form->getData());226 $this->assertEquals('2', $form->getViewData());227 }228 public function testSubmitMultipleNonExpanded()229 {230 $form = $this->factory->create('choice', null, array(231 'multiple' => true,232 'expanded' => false,233 'choices' => $this->choices,234 ));235 $form->submit(array('a', 'b'));236 $this->assertEquals(array('a', 'b'), $form->getData());237 $this->assertEquals(array('a', 'b'), $form->getViewData());238 }239 public function testSubmitMultipleNonExpandedInvalidScalarChoice()240 {241 $form = $this->factory->create('choice', null, array(242 'multiple' => true,243 'expanded' => false,244 'choices' => $this->choices,245 ));246 $form->submit('foobar');247 $this->assertNull($form->getData());248 $this->assertEquals('foobar', $form->getViewData());249 $this->assertFalse($form->isSynchronized());250 }251 public function testSubmitMultipleNonExpandedInvalidArrayChoice()252 {253 $form = $this->factory->create('choice', null, array(254 'multiple' => true,255 'expanded' => false,256 'choices' => $this->choices,257 ));258 $form->submit(array('a', 'foobar'));259 $this->assertNull($form->getData());260 $this->assertEquals(array('a', 'foobar'), $form->getViewData());261 $this->assertFalse($form->isSynchronized());262 }263 public function testSubmitMultipleNonExpandedObjectChoices()264 {265 $form = $this->factory->create('choice', null, array(266 'multiple' => true,267 'expanded' => false,268 'choice_list' => new ObjectChoiceList(269 $this->objectChoices,270 // label path271 'name',272 array(),273 null,274 // value path275 'id'276 ),277 ));278 $form->submit(array('2', '3'));279 $this->assertEquals(array($this->objectChoices[1], $this->objectChoices[2]), $form->getData());280 $this->assertEquals(array('2', '3'), $form->getViewData());281 }282 public function testSubmitSingleExpandedRequired()283 {284 $form = $this->factory->create('choice', null, array(285 'multiple' => false,286 'expanded' => true,287 'required' => true,288 'choices' => $this->choices,289 ));290 $form->submit('b');291 $this->assertSame('b', $form->getData());292 $this->assertSame(array(293 0 => false,294 1 => true,295 2 => false,296 3 => false,297 4 => false,298 ), $form->getViewData());299 $this->assertEmpty($form->getExtraData());300 $this->assertTrue($form->isSynchronized());301 $this->assertFalse($form[0]->getData());302 $this->assertTrue($form[1]->getData());303 $this->assertFalse($form[2]->getData());304 $this->assertFalse($form[3]->getData());305 $this->assertFalse($form[4]->getData());306 $this->assertNull($form[0]->getViewData());307 $this->assertSame('b', $form[1]->getViewData());308 $this->assertNull($form[2]->getViewData());309 $this->assertNull($form[3]->getViewData());310 $this->assertNull($form[4]->getViewData());311 }312 public function testSubmitSingleExpandedRequiredInvalidChoice()313 {314 $form = $this->factory->create('choice', null, array(315 'multiple' => false,316 'expanded' => true,317 'required' => true,318 'choices' => $this->choices,319 ));320 $form->submit('foobar');321 $this->assertNull($form->getData());322 $this->assertSame('foobar', $form->getViewData());323 $this->assertEmpty($form->getExtraData());324 $this->assertFalse($form->isSynchronized());325 $this->assertFalse($form[0]->getData());326 $this->assertFalse($form[1]->getData());327 $this->assertFalse($form[2]->getData());328 $this->assertFalse($form[3]->getData());329 $this->assertFalse($form[4]->getData());330 $this->assertNull($form[0]->getViewData());331 $this->assertNull($form[1]->getViewData());332 $this->assertNull($form[2]->getViewData());333 $this->assertNull($form[3]->getViewData());334 $this->assertNull($form[4]->getViewData());335 }336 public function testSubmitSingleExpandedNonRequired()337 {338 $form = $this->factory->create('choice', null, array(339 'multiple' => false,340 'expanded' => true,341 'required' => false,342 'choices' => $this->choices,343 ));344 $form->submit('b');345 $this->assertSame('b', $form->getData());346 $this->assertSame(array(347 0 => false,348 1 => true,349 2 => false,350 3 => false,351 4 => false,352 'placeholder' => false,353 ), $form->getViewData());354 $this->assertEmpty($form->getExtraData());355 $this->assertTrue($form->isSynchronized());356 $this->assertFalse($form['placeholder']->getData());357 $this->assertFalse($form[0]->getData());358 $this->assertTrue($form[1]->getData());359 $this->assertFalse($form[2]->getData());360 $this->assertFalse($form[3]->getData());361 $this->assertFalse($form[4]->getData());362 $this->assertNull($form['placeholder']->getViewData());363 $this->assertNull($form[0]->getViewData());364 $this->assertSame('b', $form[1]->getViewData());365 $this->assertNull($form[2]->getViewData());366 $this->assertNull($form[3]->getViewData());367 $this->assertNull($form[4]->getViewData());368 }369 public function testSubmitSingleExpandedNonRequiredInvalidChoice()370 {371 $form = $this->factory->create('choice', null, array(372 'multiple' => false,373 'expanded' => true,374 'required' => false,375 'choices' => $this->choices,376 ));377 $form->submit('foobar');378 $this->assertNull($form->getData());379 $this->assertSame('foobar', $form->getViewData());380 $this->assertEmpty($form->getExtraData());381 $this->assertFalse($form->isSynchronized());382 $this->assertFalse($form[0]->getData());383 $this->assertFalse($form[1]->getData());384 $this->assertFalse($form[2]->getData());385 $this->assertFalse($form[3]->getData());386 $this->assertFalse($form[4]->getData());387 $this->assertNull($form[0]->getViewData());388 $this->assertNull($form[1]->getViewData());389 $this->assertNull($form[2]->getViewData());390 $this->assertNull($form[3]->getViewData());391 $this->assertNull($form[4]->getViewData());392 }393 public function testSubmitSingleExpandedRequiredNull()394 {395 $form = $this->factory->create('choice', null, array(396 'multiple' => false,397 'expanded' => true,398 'required' => true,399 'choices' => $this->choices,400 ));401 $form->submit(null);402 $this->assertNull($form->getData());403 $this->assertSame(array(404 0 => false,405 1 => false,406 2 => false,407 3 => false,408 4 => false,409 ), $form->getViewData());410 $this->assertEmpty($form->getExtraData());411 $this->assertTrue($form->isSynchronized());412 $this->assertFalse($form[0]->getData());413 $this->assertFalse($form[1]->getData());414 $this->assertFalse($form[2]->getData());415 $this->assertFalse($form[3]->getData());416 $this->assertFalse($form[4]->getData());417 $this->assertNull($form[0]->getViewData());418 $this->assertNull($form[1]->getViewData());419 $this->assertNull($form[2]->getViewData());420 $this->assertNull($form[3]->getViewData());421 $this->assertNull($form[4]->getViewData());422 }423 public function testSubmitSingleExpandedRequiredEmpty()424 {425 $form = $this->factory->create('choice', null, array(426 'multiple' => false,427 'expanded' => true,428 'required' => true,429 'choices' => $this->choices,430 ));431 $form->submit('');432 $this->assertNull($form->getData());433 $this->assertSame(array(434 0 => false,435 1 => false,436 2 => false,437 3 => false,438 4 => false,439 ), $form->getViewData());440 $this->assertEmpty($form->getExtraData());441 $this->assertTrue($form->isSynchronized());442 $this->assertFalse($form[0]->getData());443 $this->assertFalse($form[1]->getData());444 $this->assertFalse($form[2]->getData());445 $this->assertFalse($form[3]->getData());446 $this->assertFalse($form[4]->getData());447 $this->assertNull($form[0]->getViewData());448 $this->assertNull($form[1]->getViewData());449 $this->assertNull($form[2]->getViewData());450 $this->assertNull($form[3]->getViewData());451 $this->assertNull($form[4]->getViewData());452 }453 public function testSubmitSingleExpandedRequiredFalse()454 {455 $form = $this->factory->create('choice', null, array(456 'multiple' => false,457 'expanded' => true,458 'required' => true,459 'choices' => $this->choices,460 ));461 $form->submit(false);462 $this->assertNull($form->getData());463 $this->assertSame(array(464 0 => false,465 1 => false,466 2 => false,467 3 => false,468 4 => false,469 ), $form->getViewData());470 $this->assertEmpty($form->getExtraData());471 $this->assertTrue($form->isSynchronized());472 $this->assertFalse($form[0]->getData());473 $this->assertFalse($form[1]->getData());474 $this->assertFalse($form[2]->getData());475 $this->assertFalse($form[3]->getData());476 $this->assertFalse($form[4]->getData());477 $this->assertNull($form[0]->getViewData());478 $this->assertNull($form[1]->getViewData());479 $this->assertNull($form[2]->getViewData());480 $this->assertNull($form[3]->getViewData());481 $this->assertNull($form[4]->getViewData());482 }483 public function testSubmitSingleExpandedNonRequiredNull()484 {485 $form = $this->factory->create('choice', null, array(486 'multiple' => false,487 'expanded' => true,488 'required' => false,489 'choices' => $this->choices,490 ));491 $form->submit(null);492 $this->assertNull($form->getData());493 $this->assertSame(array(494 0 => false,495 1 => false,496 2 => false,497 3 => false,498 4 => false,499 'placeholder' => true,500 ), $form->getViewData());501 $this->assertEmpty($form->getExtraData());502 $this->assertTrue($form->isSynchronized());503 $this->assertTrue($form['placeholder']->getData());504 $this->assertFalse($form[0]->getData());505 $this->assertFalse($form[1]->getData());506 $this->assertFalse($form[2]->getData());507 $this->assertFalse($form[3]->getData());508 $this->assertFalse($form[4]->getData());509 $this->assertSame('', $form['placeholder']->getViewData());510 $this->assertNull($form[0]->getViewData());511 $this->assertNull($form[1]->getViewData());512 $this->assertNull($form[2]->getViewData());513 $this->assertNull($form[3]->getViewData());514 $this->assertNull($form[4]->getViewData());515 }516 public function testSubmitSingleExpandedNonRequiredEmpty()517 {518 $form = $this->factory->create('choice', null, array(519 'multiple' => false,520 'expanded' => true,521 'required' => false,522 'choices' => $this->choices,523 ));524 $form->submit('');525 $this->assertNull($form->getData());526 $this->assertSame(array(527 0 => false,528 1 => false,529 2 => false,530 3 => false,531 4 => false,532 'placeholder' => true,533 ), $form->getViewData());534 $this->assertEmpty($form->getExtraData());535 $this->assertTrue($form->isSynchronized());536 $this->assertTrue($form['placeholder']->getData());537 $this->assertFalse($form[0]->getData());538 $this->assertFalse($form[1]->getData());539 $this->assertFalse($form[2]->getData());540 $this->assertFalse($form[3]->getData());541 $this->assertFalse($form[4]->getData());542 $this->assertSame('', $form['placeholder']->getViewData());543 $this->assertNull($form[0]->getViewData());544 $this->assertNull($form[1]->getViewData());545 $this->assertNull($form[2]->getViewData());546 $this->assertNull($form[3]->getViewData());547 $this->assertNull($form[4]->getViewData());548 }549 public function testSubmitSingleExpandedNonRequiredFalse()550 {551 $form = $this->factory->create('choice', null, array(552 'multiple' => false,553 'expanded' => true,554 'required' => false,555 'choices' => $this->choices,556 ));557 $form->submit(false);558 $this->assertNull($form->getData());559 $this->assertSame(array(560 0 => false,561 1 => false,562 2 => false,563 3 => false,564 4 => false,565 'placeholder' => true,566 ), $form->getViewData());567 $this->assertEmpty($form->getExtraData());568 $this->assertTrue($form->isSynchronized());569 $this->assertTrue($form['placeholder']->getData());570 $this->assertFalse($form[0]->getData());571 $this->assertFalse($form[1]->getData());572 $this->assertFalse($form[2]->getData());573 $this->assertFalse($form[3]->getData());574 $this->assertFalse($form[4]->getData());575 $this->assertSame('', $form['placeholder']->getViewData());576 $this->assertNull($form[0]->getViewData());577 $this->assertNull($form[1]->getViewData());578 $this->assertNull($form[2]->getViewData());579 $this->assertNull($form[3]->getViewData());580 $this->assertNull($form[4]->getViewData());581 }582 public function testSubmitSingleExpandedWithEmptyChild()583 {584 $form = $this->factory->create('choice', null, array(585 'multiple' => false,586 'expanded' => true,587 'choices' => array(588 '' => 'Empty',589 1 => 'Not empty',590 ),591 ));592 $form->submit('');593 $this->assertNull($form->getData());594 $this->assertTrue($form[0]->getData());595 $this->assertFalse($form[1]->getData());596 $this->assertSame('', $form[0]->getViewData());597 $this->assertNull($form[1]->getViewData());598 }599 public function testSubmitSingleExpandedObjectChoices()600 {601 $form = $this->factory->create('choice', null, array(602 'multiple' => false,603 'expanded' => true,604 'choice_list' => new ObjectChoiceList(605 $this->objectChoices,606 // label path607 'name',608 array(),609 null,610 // value path611 'id'612 ),613 ));614 $form->submit('2');615 $this->assertSame($this->objectChoices[1], $form->getData());616 $this->assertFalse($form[0]->getData());617 $this->assertTrue($form[1]->getData());618 $this->assertFalse($form[2]->getData());619 $this->assertFalse($form[3]->getData());620 $this->assertFalse($form[4]->getData());621 $this->assertNull($form[0]->getViewData());622 $this->assertSame('2', $form[1]->getViewData());623 $this->assertNull($form[2]->getViewData());624 $this->assertNull($form[3]->getViewData());625 $this->assertNull($form[4]->getViewData());626 }627 public function testSubmitSingleExpandedNumericChoices()628 {629 $form = $this->factory->create('choice', null, array(630 'multiple' => false,631 'expanded' => true,632 'choices' => $this->numericChoices,633 ));634 $form->submit('1');635 $this->assertSame(1, $form->getData());636 $this->assertFalse($form[0]->getData());637 $this->assertTrue($form[1]->getData());638 $this->assertFalse($form[2]->getData());639 $this->assertFalse($form[3]->getData());640 $this->assertFalse($form[4]->getData());641 $this->assertNull($form[0]->getViewData());642 $this->assertSame('1', $form[1]->getViewData());643 $this->assertNull($form[2]->getViewData());644 $this->assertNull($form[3]->getViewData());645 $this->assertNull($form[4]->getViewData());646 }647 public function testSubmitMultipleExpanded()648 {649 $form = $this->factory->create('choice', null, array(650 'multiple' => true,651 'expanded' => true,652 'choices' => $this->choices,653 ));654 $form->submit(array('a', 'c'));655 $this->assertSame(array('a', 'c'), $form->getData());656 $this->assertSame(array(657 0 => true,658 1 => false,659 2 => true,660 3 => false,661 4 => false,662 ), $form->getViewData());663 $this->assertEmpty($form->getExtraData());664 $this->assertTrue($form->isSynchronized());665 $this->assertTrue($form[0]->getData());666 $this->assertFalse($form[1]->getData());667 $this->assertTrue($form[2]->getData());668 $this->assertFalse($form[3]->getData());669 $this->assertFalse($form[4]->getData());670 $this->assertSame('a', $form[0]->getViewData());671 $this->assertNull($form[1]->getViewData());672 $this->assertSame('c', $form[2]->getViewData());673 $this->assertNull($form[3]->getViewData());674 $this->assertNull($form[4]->getViewData());675 }676 public function testSubmitMultipleExpandedInvalidScalarChoice()677 {678 $form = $this->factory->create('choice', null, array(679 'multiple' => true,680 'expanded' => true,681 'choices' => $this->choices,682 ));683 $form->submit('foobar');684 $this->assertNull($form->getData());685 $this->assertSame('foobar', $form->getViewData());686 $this->assertEmpty($form->getExtraData());687 $this->assertFalse($form->isSynchronized());688 $this->assertFalse($form[0]->getData());689 $this->assertFalse($form[1]->getData());690 $this->assertFalse($form[2]->getData());691 $this->assertFalse($form[3]->getData());692 $this->assertFalse($form[4]->getData());693 $this->assertNull($form[0]->getViewData());694 $this->assertNull($form[1]->getViewData());695 $this->assertNull($form[2]->getViewData());696 $this->assertNull($form[3]->getViewData());697 $this->assertNull($form[4]->getViewData());698 }699 public function testSubmitMultipleExpandedInvalidArrayChoice()700 {701 $form = $this->factory->create('choice', null, array(702 'multiple' => true,703 'expanded' => true,704 'choices' => $this->choices,705 ));706 $form->submit(array('a', 'foobar'));707 $this->assertNull($form->getData());708 $this->assertSame(array('a', 'foobar'), $form->getViewData());709 $this->assertEmpty($form->getExtraData());710 $this->assertFalse($form->isSynchronized());711 $this->assertFalse($form[0]->getData());712 $this->assertFalse($form[1]->getData());713 $this->assertFalse($form[2]->getData());714 $this->assertFalse($form[3]->getData());715 $this->assertFalse($form[4]->getData());716 $this->assertNull($form[0]->getViewData());717 $this->assertNull($form[1]->getViewData());718 $this->assertNull($form[2]->getViewData());719 $this->assertNull($form[3]->getViewData());720 $this->assertNull($form[4]->getViewData());721 }722 public function testSubmitMultipleExpandedEmpty()723 {724 $form = $this->factory->create('choice', null, array(725 'multiple' => true,726 'expanded' => true,727 'choices' => $this->choices,728 ));729 $form->submit(array());730 $this->assertSame(array(), $form->getData());731 $this->assertFalse($form[0]->getData());732 $this->assertFalse($form[1]->getData());733 $this->assertFalse($form[2]->getData());734 $this->assertFalse($form[3]->getData());735 $this->assertFalse($form[4]->getData());736 $this->assertNull($form[0]->getViewData());737 $this->assertNull($form[1]->getViewData());738 $this->assertNull($form[2]->getViewData());739 $this->assertNull($form[3]->getViewData());740 $this->assertNull($form[4]->getViewData());741 }742 public function testSubmitMultipleExpandedWithEmptyChild()743 {744 $form = $this->factory->create('choice', null, array(745 'multiple' => true,746 'expanded' => true,747 'choices' => array(748 '' => 'Empty',749 1 => 'Not Empty',750 2 => 'Not Empty 2',751 ),752 ));753 $form->submit(array('', '2'));754 $this->assertSame(array('', 2), $form->getData());755 $this->assertTrue($form[0]->getData());756 $this->assertFalse($form[1]->getData());757 $this->assertTrue($form[2]->getData());758 $this->assertSame('', $form[0]->getViewData());759 $this->assertNull($form[1]->getViewData());760 $this->assertSame('2', $form[2]->getViewData());761 }762 public function testSubmitMultipleExpandedObjectChoices()763 {764 $form = $this->factory->create('choice', null, array(765 'multiple' => true,766 'expanded' => true,767 'choice_list' => new ObjectChoiceList(768 $this->objectChoices,769 // label path770 'name',771 array(),772 null,773 // value path774 'id'775 ),776 ));777 $form->submit(array('1', '2'));778 $this->assertSame(array($this->objectChoices[0], $this->objectChoices[1]), $form->getData());779 $this->assertTrue($form[0]->getData());780 $this->assertTrue($form[1]->getData());781 $this->assertFalse($form[2]->getData());782 $this->assertFalse($form[3]->getData());783 $this->assertFalse($form[4]->getData());784 $this->assertSame('1', $form[0]->getViewData());785 $this->assertSame('2', $form[1]->getViewData());786 $this->assertNull($form[2]->getViewData());787 $this->assertNull($form[3]->getViewData());788 $this->assertNull($form[4]->getViewData());789 }790 public function testSubmitMultipleExpandedNumericChoices()791 {792 $form = $this->factory->create('choice', null, array(793 'multiple' => true,794 'expanded' => true,795 'choices' => $this->numericChoices,796 ));797 $form->submit(array('1', '2'));798 $this->assertSame(array(1, 2), $form->getData());799 $this->assertFalse($form[0]->getData());800 $this->assertTrue($form[1]->getData());801 $this->assertTrue($form[2]->getData());802 $this->assertFalse($form[3]->getData());803 $this->assertFalse($form[4]->getData());804 $this->assertNull($form[0]->getViewData());805 $this->assertSame('1', $form[1]->getViewData());806 $this->assertSame('2', $form[2]->getViewData());807 $this->assertNull($form[3]->getViewData());808 $this->assertNull($form[4]->getViewData());809 }810 /*811 * We need this functionality to create choice fields for Boolean types,812 * e.g. false => 'No', true => 'Yes'813 */814 public function testSetDataSingleNonExpandedAcceptsBoolean()815 {816 $form = $this->factory->create('choice', null, array(817 'multiple' => false,818 'expanded' => false,819 'choices' => $this->numericChoices,820 ));821 $form->setData(false);822 $this->assertFalse($form->getData());823 $this->assertEquals('0', $form->getViewData());824 }825 public function testSetDataMultipleNonExpandedAcceptsBoolean()826 {827 $form = $this->factory->create('choice', null, array(828 'multiple' => true,829 'expanded' => false,830 'choices' => $this->numericChoices,831 ));832 $form->setData(array(false, true));833 $this->assertEquals(array(false, true), $form->getData());834 $this->assertEquals(array('0', '1'), $form->getViewData());835 }836 public function testPassRequiredToView()837 {838 $form = $this->factory->create('choice', null, array(839 'choices' => $this->choices,840 ));841 $view = $form->createView();842 $this->assertTrue($view->vars['required']);843 }844 public function testPassNonRequiredToView()845 {846 $form = $this->factory->create('choice', null, array(847 'required' => false,...

Full Screen

Full Screen

MergeCollectionListenerTest.php

Source:MergeCollectionListenerTest.php Github

copy

Full Screen

...43 [false, true],44 [false, false],45 ];46 }47 abstract protected function getData(array $data);48 /**49 * @dataProvider getBooleanMatrix150 */51 public function testAddExtraEntriesIfAllowAdd($allowDelete)52 {53 $originalData = $this->getData([1 => 'second']);54 $newData = $this->getData([0 => 'first', 1 => 'second', 2 => 'third']);55 $listener = new MergeCollectionListener(true, $allowDelete);56 $this->form->setData($originalData);57 $event = new FormEvent($this->form, $newData);58 $listener->onSubmit($event);59 // The original object was modified60 if (\is_object($originalData)) {61 $this->assertSame($originalData, $event->getData());62 }63 // The original object matches the new object64 $this->assertEquals($newData, $event->getData());65 }66 /**67 * @dataProvider getBooleanMatrix168 */69 public function testAddExtraEntriesIfAllowAddDontOverwriteExistingIndices($allowDelete)70 {71 $originalData = $this->getData([1 => 'first']);72 $newData = $this->getData([0 => 'first', 1 => 'second']);73 $listener = new MergeCollectionListener(true, $allowDelete);74 $this->form->setData($originalData);75 $event = new FormEvent($this->form, $newData);76 $listener->onSubmit($event);77 // The original object was modified78 if (\is_object($originalData)) {79 $this->assertSame($originalData, $event->getData());80 }81 // The original object matches the new object82 $this->assertEquals($this->getData([1 => 'first', 2 => 'second']), $event->getData());83 }84 /**85 * @dataProvider getBooleanMatrix186 */87 public function testDoNothingIfNotAllowAdd($allowDelete)88 {89 $originalDataArray = [1 => 'second'];90 $originalData = $this->getData($originalDataArray);91 $newData = $this->getData([0 => 'first', 1 => 'second', 2 => 'third']);92 $listener = new MergeCollectionListener(false, $allowDelete);93 $this->form->setData($originalData);94 $event = new FormEvent($this->form, $newData);95 $listener->onSubmit($event);96 // We still have the original object97 if (\is_object($originalData)) {98 $this->assertSame($originalData, $event->getData());99 }100 // Nothing was removed101 $this->assertEquals($this->getData($originalDataArray), $event->getData());102 }103 /**104 * @dataProvider getBooleanMatrix1105 */106 public function testRemoveMissingEntriesIfAllowDelete($allowAdd)107 {108 $originalData = $this->getData([0 => 'first', 1 => 'second', 2 => 'third']);109 $newData = $this->getData([1 => 'second']);110 $listener = new MergeCollectionListener($allowAdd, true);111 $this->form->setData($originalData);112 $event = new FormEvent($this->form, $newData);113 $listener->onSubmit($event);114 // The original object was modified115 if (\is_object($originalData)) {116 $this->assertSame($originalData, $event->getData());117 }118 // The original object matches the new object119 $this->assertEquals($newData, $event->getData());120 }121 /**122 * @dataProvider getBooleanMatrix1123 */124 public function testDoNothingIfNotAllowDelete($allowAdd)125 {126 $originalDataArray = [0 => 'first', 1 => 'second', 2 => 'third'];127 $originalData = $this->getData($originalDataArray);128 $newData = $this->getData([1 => 'second']);129 $listener = new MergeCollectionListener($allowAdd, false);130 $this->form->setData($originalData);131 $event = new FormEvent($this->form, $newData);132 $listener->onSubmit($event);133 // We still have the original object134 if (\is_object($originalData)) {135 $this->assertSame($originalData, $event->getData());136 }137 // Nothing was removed138 $this->assertEquals($this->getData($originalDataArray), $event->getData());139 }140 /**141 * @dataProvider getBooleanMatrix2142 */143 public function testRequireArrayOrTraversable($allowAdd, $allowDelete)144 {145 $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException');146 $newData = 'no array or traversable';147 $event = new FormEvent($this->form, $newData);148 $listener = new MergeCollectionListener($allowAdd, $allowDelete);149 $listener->onSubmit($event);150 }151 public function testDealWithNullData()152 {153 $originalData = $this->getData([0 => 'first', 1 => 'second', 2 => 'third']);154 $newData = null;155 $listener = new MergeCollectionListener(false, false);156 $this->form->setData($originalData);157 $event = new FormEvent($this->form, $newData);158 $listener->onSubmit($event);159 $this->assertSame($originalData, $event->getData());160 }161 /**162 * @dataProvider getBooleanMatrix1163 */164 public function testDealWithNullOriginalDataIfAllowAdd($allowDelete)165 {166 $originalData = null;167 $newData = $this->getData([0 => 'first', 1 => 'second', 2 => 'third']);168 $listener = new MergeCollectionListener(true, $allowDelete);169 $this->form->setData($originalData);170 $event = new FormEvent($this->form, $newData);171 $listener->onSubmit($event);172 $this->assertSame($newData, $event->getData());173 }174 /**175 * @dataProvider getBooleanMatrix1176 */177 public function testDontDealWithNullOriginalDataIfNotAllowAdd($allowDelete)178 {179 $originalData = null;180 $newData = $this->getData([0 => 'first', 1 => 'second', 2 => 'third']);181 $listener = new MergeCollectionListener(false, $allowDelete);182 $this->form->setData($originalData);183 $event = new FormEvent($this->form, $newData);184 $listener->onSubmit($event);185 $this->assertNull($event->getData());186 }187}...

Full Screen

Full Screen

getData

Using AI Code Generation

copy

Full Screen

1$obj = new data();2echo $obj->getData();3$obj = new data();4echo $obj->getData();5$obj = new data();6echo $obj->getData();7$obj = new data();8echo $obj->getData();9$obj = new data();10echo $obj->getData();11$obj = new data();12echo $obj->getData();13$obj = new data();14echo $obj->getData();15$obj = new data();16echo $obj->getData();17$obj = new data();18echo $obj->getData();19$obj = new data();20echo $obj->getData();21class ClassName {22 public static function methodName() {

Full Screen

Full Screen

getData

Using AI Code Generation

copy

Full Screen

1$objData = new data();2$objData->getData();3$objData = new data();4$objData->getData();5$objData = new data();6$objData->getData();7$objData = new data();8$objData->getData();9$objData = new data();10$objData->getData();11$objData = new data();12$objData->getData();13$objData = new data();14$objData->getData();15$objData = new data();16$objData->getData();17$objData = new data();18$objData->getData();19$objData = new data();20$objData->getData();21$objData = new data();22$objData->getData();23$objData = new data();24$objData->getData();25$objData = new data();26$objData->getData();27$objData = new data();28$objData->getData();29$objData = new data();30$objData->getData();31$objData = new data();32$objData->getData();33$objData = new data();34$objData->getData();35$objData = new data();36$objData->getData();

Full Screen

Full Screen

getData

Using AI Code Generation

copy

Full Screen

1$dataObj = new data;2$dataObj->getData();3$dataObj = new data;4$dataObj->getData();5$dataObj = new data;6$dataObj->getData();7$dataObj = new data;8$dataObj->getData();9$dataObj = new data;10$dataObj->getData();11$dataObj = new data;12$dataObj->getData();13$dataObj = new data;14$dataObj->getData();15$dataObj = new data;16$dataObj->getData();17$dataObj = new data;18$dataObj->getData();19$dataObj = new data;20$dataObj->getData();21$dataObj = new data;22$dataObj->getData();23$dataObj = new data;24$dataObj->getData();25$dataObj = new data;26$dataObj->getData();27$dataObj = new data;28$dataObj->getData();29$dataObj = new data;30$dataObj->getData();31$dataObj = new data;32$dataObj->getData();33$dataObj = new data;34$dataObj->getData();35$dataObj = new data;36$dataObj->getData();

Full Screen

Full Screen

getData

Using AI Code Generation

copy

Full Screen

1$data = new data();2$data->getData();3$data = new data();4$data->setData();5$data = new data();6$data->getData();

Full Screen

Full Screen

getData

Using AI Code Generation

copy

Full Screen

1$data = new data();2$result = $data->getData();3echo $result;4$data = new data();5$result = $data->setData(10);6echo $result;7In the above example, we have created a class data which contains two methods getData() and setData() . In the first file, we have created an object of data class and called the getData() method which returns the value of $data variable. In the second file

Full Screen

Full Screen

getData

Using AI Code Generation

copy

Full Screen

1$data = $this->getData();2$this->loadView('1.php', $data);3}4$data = $this->getData();5$this->loadView('2.php', $data);6}7$data = $this->getData();8$this->loadView('3.php', $data);9}10$sth = $this->db->prepare("INSERT INTO table (name, surname, email) VALUES (:name, :surname, :email)");11$sth->execute(array(':name' => $name, ':surname' => $surname, ':email' => $email));12$sth = $this->db->prepare("UPDATE table SET name = :name, surname = :surname, email = :email WHERE id = :id");13$sth->execute(array(':name' => $name, ':surname' => $surname, ':email' => $email, ':id' => $id));14$sth = $this->db->prepare("INSERT INTO table (name, surname, email) VALUES (:name, :surname, :email)");15$sth->execute(array(':name' => $name, ':surname' => $surname, ':email' => $email));

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger getData code on LambdaTest Cloud Grid

Execute automation tests with getData on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful