These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\Tests\Entity\FormSubmissionFieldTypes; |
||
4 | |||
5 | use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField; |
||
6 | use Kunstmaan\FormBundle\Form\EmailFormSubmissionType; |
||
7 | |||
8 | /** |
||
9 | * Tests for EmailFormSubmissionField |
||
10 | */ |
||
11 | View Code Duplication | class EmailFormSubmissionFieldTest extends \PHPUnit_Framework_TestCase |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | /** |
||
14 | * @var EmailFormSubmissionField |
||
15 | */ |
||
16 | protected $object; |
||
17 | |||
18 | /** |
||
19 | * Sets up the fixture, for example, opens a network connection. |
||
20 | * This method is called before a test is executed. |
||
21 | */ |
||
22 | protected function setUp() |
||
23 | { |
||
24 | $this->object = new EmailFormSubmissionField; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Tears down the fixture, for example, closes a network connection. |
||
29 | * This method is called after a test is executed. |
||
30 | */ |
||
31 | protected function tearDown() |
||
32 | { |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @covers Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField::getValue |
||
37 | * @covers Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField::setValue |
||
38 | */ |
||
39 | public function testSetGetValue() |
||
40 | { |
||
41 | $object = $this->object; |
||
42 | $value = '[email protected]'; |
||
43 | $object->setValue($value); |
||
44 | $this->assertEquals($value, $object->getValue()); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @covers Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField::getDefaultAdminType |
||
49 | */ |
||
50 | public function testGetDefaultAdminType() |
||
51 | { |
||
52 | $this->assertEquals(EmailFormSubmissionType::class, $this->object->getDefaultAdminType()); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @covers Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField::__toString |
||
57 | */ |
||
58 | public function testToString() |
||
59 | { |
||
60 | $stringValue = $this->object->__toString(); |
||
61 | $this->assertNotNull($stringValue); |
||
62 | $this->assertTrue(is_string($stringValue)); |
||
63 | } |
||
64 | } |
||
65 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.