Skip to content

Commit cddd958

Browse files
committed
100% code covered with tests
1 parent 085b440 commit cddd958

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

tests/Core/FieldType/EnhancedBinaryFile/TypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function testValidateWithMineTypesFromConfig()
108108
->with($this->file)
109109
->willReturn('text/plain');
110110

111-
$this->configResolver->expects($this->any())
111+
$this->configResolver->expects($this->exactly(3))
112112
->method('hasParameter')
113113
->will(
114114
$this->returnCallback(function ($arg) {

tests/Form/FieldTypeHandler/EnhancedFileTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,30 @@ public function testConvertFieldValueFromFormWithFile()
6060
public function testBuildFieldCreateForm()
6161
{
6262
$formBuilder = $this->createMock(FormBuilderInterface::class);
63-
$fieldDefinition = new FieldDefinition();
63+
$fieldDefinition = new FieldDefinition(array(
64+
'fieldSettings' => array(
65+
'allowedTypes' => 'jpg|pdf|txt',
66+
),
67+
));
6468
$lang = 'eng_US';
69+
70+
$this->configResolver->expects($this->exactly(3))
71+
->method('hasParameter')
72+
->will(
73+
$this->returnCallback(function ($arg) {
74+
if ('txt.Types' === $arg) {
75+
return true;
76+
}
77+
78+
return false;
79+
})
80+
);
81+
82+
$this->configResolver->expects($this->once())
83+
->method('getParameter')
84+
->with('txt.Types', 'mime')
85+
->willReturn(array('text/plain'));
86+
6587
$this->handler->buildFieldCreateForm($formBuilder, $fieldDefinition, $lang);
6688
}
6789
}

0 commit comments

Comments
 (0)