File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
src/Symfony/Component/HttpFoundation Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,13 @@ public static function getInstance()
67
67
return self ::$ instance ;
68
68
}
69
69
70
+ /**
71
+ * Resets the singleton instance.
72
+ */
73
+ public static function reset () {
74
+ self ::$ instance = null ;
75
+ }
76
+
70
77
/**
71
78
* Registers all natively provided mime type guessers.
72
79
*/
Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ public function testGuessExtensionIsBasedOnMimeType()
45
45
$ this ->assertEquals ('gif ' , $ file ->guessExtension ());
46
46
}
47
47
48
+ public function testGuessExtensionWithReset () {
49
+ $ file = new File (__DIR__ .'/Fixtures/other-file.example ' );
50
+ $ guesser = $ this ->createMockGuesser ($ file ->getPathname (), 'image/gif ' );
51
+ MimeTypeGuesser::getInstance ()->register ($ guesser );
52
+
53
+ $ this ->assertEquals ('gif ' , $ file ->guessExtension ());
54
+
55
+ MimeTypeGuesser::reset ();
56
+
57
+ $ this ->assertNull ($ file ->guessExtension ());
58
+ }
59
+
48
60
public function testConstructWhenFileNotExists ()
49
61
{
50
62
$ this ->setExpectedException ('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException ' );
You can’t perform that action at this time.
0 commit comments