New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set correct mime-type for js files (should be application/javascript) - fixes #4496 #239
Set correct mime-type for js files (should be application/javascript) - fixes #4496 #239
Conversation
Build Scheduled |
Please create a unit test for this. |
No problem, but just wanted to check what/how you want testing. As far as I can see in https://github.com/kohana/core/blob/3.2/develop/tests/kohana/FileTest.php File::mime_by_ext currently isn't covered at all and File::mime's test just validates that it returns a valid mime-type rather than asserting a specific result (in fact, from the doc-comments looks like it was refactored to do that as the comments still refer to a $expected parameter which is no longer present). Should I pick maybe this, something without an extension and something where the extension maps to an array of types and test against specific assertions? Or do you more want a ticket test just for this specific type? Presumably a full test matching everything in the mime_types config would be overkill. Just want to be sure my test matches your strategy for these classes. |
@shadowhand, not sure if you saw my reply above- if you can give me a pointer on how you'd like to see this patch for File::mime_by_ext tested (given the method isnt currently tested at all) I'll get that implemented. |
This should be pretty easy to test, all you need to do is call File::mime_by_ext on a filename and verify the result. |
@shadowhand, thanks I understand how to write a test for this. As above, That will obviously test this specific change but will give very limited On 20 May 2012 22:49, "Woody Gilk" <
|
You will have to create the unit test file yourself. As long as this method is tested, we can accept the pull request. If you want to create tests for other methods, even better! |
@shadowhand obviously I'll add the test to Kohana_FileTest rather than add I'm either being really unclear, or you're not actually reading what I'm Basically, do you want me to explicitly test the return value is In other words, should the test of the File::mime_by_ext method be coupled It also would seem bizarre to write a test just for this one input/output
|
@acoulton After some thought, I don't think it makes sense to unit test this, as all the values to test against come from configuration files. If the user has a different MIME preference, unit tests will start failing. I'm going to merge this as-is. |
Set correct mime-type for js files, fixes #4496
Merged up to 3.3/develop in 9233fd0 |
Great, thanks @shadowhand. On Thu, May 24, 2012 at 6:59 AM, Woody Gilk <
|
A very small change to fix http://dev.kohanaframework.org/issues/4496 - File::mime_by_ext reports an invalid mime-type (application/x-javascript) for .js files which is not valid per the RFC.