Skip to content

Commit fef31a3

Browse files
committed
fix
1 parent 7d0d4b9 commit fef31a3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/src/MapHandlerTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ public function testAdd(): void
4747
{
4848
// Adding a new type with a new extension.
4949
$this->map->addTypeExtensionMapping('bingo/bongo', 'bngbng');
50+
$this->map->addTypeDescription('bingo/bongo', 'Bingo, Bongo!');
5051
$this->assertSame(['bngbng'], (new Type('bingo/bongo'))->getExtensions());
5152
$this->assertSame('bngbng', (new Type('bingo/bongo'))->getDefaultExtension());
53+
$this->assertSame('Bingo, Bongo!', (new Type('bingo/bongo'))->getDescription());
5254
$this->assertSame(['bingo/bongo'], (new Extension('bngbng'))->getTypes());
5355
$this->assertSame('bingo/bongo', (new Extension('bngbng'))->getDefaultType());
5456

@@ -200,6 +202,14 @@ public function testSetExtensionDefaultType(): void
200202
$this->assertSame(['image/vnd.dvb.subtitle', 'text/vnd.dvb.subtitle', 'text/x-microdvd', 'text/x-mpsub', 'text/x-subviewer'], (new Extension('SUB'))->getTypes());
201203
}
202204

205+
public function testAddAliasToType(): void
206+
{
207+
$this->assertSame(['image/psd', 'image/x-psd', 'image/photoshop', 'image/x-photoshop', 'application/photoshop', 'application/x-photoshop',], (new Type('image/vnd.adobe.photoshop'))->getAliases());
208+
$this->map->addTypeAlias('image/vnd.adobe.photoshop', 'application/x-foo-bar');
209+
$this->assertSame(['image/psd', 'image/x-psd', 'image/photoshop', 'image/x-photoshop', 'application/photoshop', 'application/x-photoshop', 'application/x-foo-bar',], (new Type('image/vnd.adobe.photoshop'))->getAliases());
210+
$this->assertContains('application/x-foo-bar', $this->map->listAliases());
211+
}
212+
203213
public function testReAddAliasToType(): void
204214
{
205215
$this->assertSame(['image/psd', 'image/x-psd', 'image/photoshop', 'image/x-photoshop', 'application/photoshop', 'application/x-photoshop',], (new Type('image/vnd.adobe.photoshop'))->getAliases());

tests/src/MapUpdaterTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ public function testWriteMapToPhpClassFileFailure(): void
182182
$content = file_get_contents($map_a->getFileName());
183183
assert(is_string($content));
184184
$this->assertStringNotContainsString('text/plain', $content);
185+
$this->expectException(\RuntimeException::class);
186+
$this->expectExceptionMessage("Failed loading file foo://bar.stub");
185187
$this->updater->writeMapToPhpClassFile("foo://bar.stub");
186188
}
187189

0 commit comments

Comments
 (0)