Skip to content

Commit 3589c81

Browse files
committed
More verbose test
1 parent 600dcf2 commit 3589c81

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/Core/FieldType/EnhancedBinaryFile/TypeTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,43 @@ public function testValidateWithMineTypesFromConfig()
128128
$this->type->validate($fieldDefinition, $value);
129129
}
130130

131+
public function testValidateWithNoMimeTypesFromConfig()
132+
{
133+
$fieldDefinition = new FieldDefinition(array(
134+
'fieldSettings' => array(
135+
'allowedTypes' => 'jpg|pdf|txt',
136+
),
137+
));
138+
139+
$value = new Value(array(
140+
'path' => $this->file,
141+
));
142+
143+
$this->mimeTypeDetector->expects($this->once())
144+
->method('getFromPath')
145+
->with($this->file)
146+
->willReturn('text/plain');
147+
148+
$this->configResolver->expects($this->exactly(3))
149+
->method('hasParameter')
150+
->will(
151+
$this->returnCallback(function ($arg) {
152+
if ('txt.Types' === $arg) {
153+
return true;
154+
}
155+
156+
return false;
157+
})
158+
);
159+
160+
$this->configResolver->expects($this->once())
161+
->method('getParameter')
162+
->with('txt.Types', 'mime')
163+
->willReturn(array('something'));
164+
165+
$this->type->validate($fieldDefinition, $value);
166+
}
167+
131168
public function testValidateFieldSettingsWithEmptyArray()
132169
{
133170
$result = $this->type->validateFieldSettings(array());

0 commit comments

Comments
 (0)