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\StringFormSubmissionField; |
||
6 | use Kunstmaan\FormBundle\Form\StringFormSubmissionType; |
||
7 | |||
8 | /** |
||
9 | * Tests for StringFormSubmissionField |
||
10 | */ |
||
11 | View Code Duplication | class StringFormSubmissionFieldTest extends \PHPUnit_Framework_TestCase |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | /** |
||
14 | * @var StringFormSubmissionField |
||
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 StringFormSubmissionField(); |
||
25 | } |
||
26 | |||
27 | public function testSetGetValue() |
||
28 | { |
||
29 | $object = $this->object; |
||
30 | $value = 'test'; |
||
31 | $object->setValue($value); |
||
32 | $this->assertEquals($value, $object->getValue()); |
||
33 | } |
||
34 | |||
35 | public function testGetDefaultAdminType() |
||
36 | { |
||
37 | $this->assertEquals(StringFormSubmissionType::class, $this->object->getDefaultAdminType()); |
||
38 | } |
||
39 | |||
40 | public function testToString() |
||
41 | { |
||
42 | $stringValue = $this->object->__toString(); |
||
43 | $this->assertNotNull($stringValue); |
||
44 | $this->assertTrue(is_string($stringValue)); |
||
45 | } |
||
46 | } |
||
47 |
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.