コード例 #1
0
 public function test_formulaire_creation()
 {
     $input3 = $this->mockInputText('name3');
     $input2 = $this->mockInputText('name2');
     $input1 = $this->mockInputText('name1');
     $form = new Form();
     $form->addInput($input3);
     $form_html = $form->getDisplay();
     $this->assertRegExp('/<input type=\\"text\\"/', $form_html);
     $form->addInput($input1);
     $form->addInput($input2);
     $form_html = $form->getDisplay();
     $this->assertRegExp('/name3/', $form_html);
     $this->assertRegExp('/name1/', $form_html);
     $this->assertRegExp('/name2/', $form_html);
     $this->assertEquals(3, substr_count($form_html, 'input'));
     $remove = $form->removeInput($input3);
     $this->assertTrue($remove);
     $form_html = $form->getDisplay();
     $this->assertNotRegExp('/name3/', $form_html);
     $this->assertRegExp('/name1/', $form_html);
     $this->assertRegExp('/name2/', $form_html);
     $this->assertEquals(2, substr_count($form_html, 'input'));
 }