Skip to content

Fix skipped/incomplete core tests for 3.3 series #552

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

Merged
merged 7 commits into from
Sep 23, 2014

Conversation

acoulton
Copy link
Member

This pull reinstates and improves tests that were being skipped on CI as discussed in #547, in particular:

  • Internally refactoring the Cookie class so tests can run regardless of headers being sent or not
  • Rewriting the Cookie tests so they actually cover the setting / signing / salting logic - the original assertions were relatively meaningless.
  • Rewriting the tests for Kohana::message to cover more cases and be independent of any other modules or message files
  • Rewriting the tests for Feed::parse to test parsing of local sample Atom and RSS2.0 feeds.
  • Removing a long-since invalid test that Response::send_headers does not send headers in CLI (it does, and has since 3.2.0).

There are now no skipped tests on kohana/core.

NB that this PR depends on the changes in #548, once that's merged I'll rebase this.

@enov are you happy that the refactorings here are all safe to release in the 3.3 bugfix series?

@acoulton
Copy link
Member Author

This PR is not ready to merge, it requires #548 and a rebase first

@enov
Copy link
Contributor

enov commented Sep 19, 2014

Excellent work @acoulton !

@acoulton acoulton force-pushed the 3.3/bug/reinstate-skipped-tests branch 2 times, most recently from 65d2131 to 6082568 Compare September 23, 2014 06:34
@acoulton
Copy link
Member Author

This is now ready for review and merge - all 18 skipped/incomplete tests are now green.

The cookie tests were all being skipped because headers are always sent
by the PHPUnit test runner (fixes kohana/kohana#47).

Additionally even when they ran they were covering very little of the actual
logic of the class, mostly just asserting that setcookie returns TRUE. Rewrote
the tests completely and slightly refactored the Cookie class to allow
mocking of the timestamp and setcookie calls.

Refs #547.
These tests were disabled in 46e2ee9 because they were generating
an error if headers had already been sent.

http://dev.kohanaframework.org/issues/4155

 This appears no longer the case - presumably the Session class or test
 configuration/environment has changed since then.

The tests could probably still be clearer and more comprehensive, but they
run.
These tests aren't great, and the PHP mime-type test is particularly likely to be
unreliable. We should be able to get a valid (eg image/png) result in all current
environments though for the moment.

Probably the File::mime method would be best reimplemented with some
third-party component, surely this is a solved problem by now.
These tests were vulnerable to breakage if modules provide
their own validation message files, so were being skipped.

Fixed to use (hopefully) collision-proof message files with
known values and to cover a broader range of cases
including missing file and missing key.

Would ideally be further refactored to mock/have complete
control of the module search path outside global state.
Original test was being skipped because it was hitting the internet
- the major relevant functionality here is the parsing rather than
the remote access.

Added local example feeds for RSS2.0 as well as the previously
tested atom feed. Also improved the tests to check for the title
as well as the number of elements since we now have known
content to work with.
This test was originally implemented in bf0175f to fix
http://dev.kohanaframework.org/issues/3767 - it was required
because headers were sent directly by the response class, and
once they had been sent it was then very difficult to test other
variations. The fact that headers are not relevant in CLI appears
to have been a side concern.

Subsequently in a1943b0 header sending moved to
HTTP_Header which mocks out `header` with a callback interface
for testing instead.

Since that refactoring (released in v3.2.0) the headers are always
sent in CLI unless headers_sent is already true.

Therefore this test is invalid and can be removed.
@acoulton acoulton force-pushed the 3.3/bug/reinstate-skipped-tests branch from 6082568 to 1631e0b Compare September 23, 2014 11:24
enov added a commit that referenced this pull request Sep 23, 2014
Fix skipped/incomplete core tests for 3.3 series
@enov enov merged commit 67295df into 3.3/develop Sep 23, 2014
@acoulton acoulton deleted the 3.3/bug/reinstate-skipped-tests branch September 26, 2014 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants