Commit graph

18 commits

Author SHA1 Message Date
Thiemo Kreuz d0cb639e03 Minor improvements to the test coverage
We are *so* close to 90%.

This patch should raise the coverage for the CiteDataModule to 100%.
I'm also adding a pure unit test for the clone() behavior. Note the
later is already covered by the CiteDbTest.

Question: Do we want the CiteDbTest to @cover anything?

Change-Id: I40763d01e18991f509bc30b6655aa57b23412fd9
2019-12-11 12:22:59 +01:00
Thiemo Kreuz 71c6dc7fe4 Better naming for ReferenceFormatter class and methods
This class renders a <references> tag and everything inside. The
previous name sounds like it is responsible for rendering the contents
of a <ref>…</ref> tag. I mean, the class contains a method that does
exactly this. But this method is private.

Change-Id: I1cd06c9a11e0a74104f2874a34efa3e0843a0f70
2019-12-10 08:40:09 +01:00
Adam Wight 8097c4c148 Split validation function depending on inReferencesGroup
Some validation is exclusively used in a specific context, some is shared.

Change-Id: I390db1c9d4854871e25a2e74411476e4e1c0b66f
2019-12-09 12:27:52 +01:00
Thiemo Kreuz 8fdce945bd Show "Preview" headline in user instead of content language
This partly reverts Id7a4036e64920acdeccb4dfcf6bef31d0e5657ab.

The message "cite_section_preview_references" says "Preview of references".
This line is not meant to be part of the content, but an interface message.
It should use the users (interface) language, not the content language.

Change-Id: I1b1b5106266606eb0dfaa31f4abd3cee9ba92e8c
2019-12-09 10:53:07 +01:00
Adam Wight 430086cb6b Use the message localizer in Cite
Allows us to convert another integration test into a unit test.

Change-Id: Id7a4036e64920acdeccb4dfcf6bef31d0e5657ab
2019-12-05 13:23:31 +01:00
Adam Wight 1f92841662 Test coverage for guardedReferences
Change-Id: Id97ba7a965dfd78579fc18e7f3d21a595e6bf432
2019-12-05 08:59:22 +01:00
jenkins-bot 336dd4a27c Merge "Complete validateRef coverage" 2019-12-04 17:18:40 +00:00
Adam Wight 5705228d17 Complete validateRef coverage
Change-Id: Id61fba34a8815a0c512ecf4bc57da3be4e15c8bb
2019-12-04 18:00:13 +01:00
Adam Wight 3d049159c2 Tests for guardedRef
This is a mess of a function, and the tests show it.  There are lots
of side-effects and context-sensitivity, which can be addressed in
later work.  The interface with ReferenceStack is too wide.

Change-Id: I00cab2a555b2a9efd32d937979cd722d43ac1005
2019-12-04 16:06:10 +00:00
Adam Wight 817c58230f Rename test to follow function name
Change-Id: I6e925f65ba7c59738ad4e55748f1efdb4cf04573
2019-12-04 11:23:55 +01:00
Adam Wight d40bf92396 Make integration test into a unit test
We were mocking ParserOutput anyway, so this is the same test as before.

Change-Id: If31898b537db946b6b4a595663d3894d05d94e77
2019-12-03 14:07:48 +01:00
Adam Wight a40b1b10be Extract footnote body rendering
Change-Id: I9537849cbd700d5dc7ec1a53d852d69b0fe0dc35
2019-11-29 16:22:35 +01:00
Adam Wight a4c056f59b Extract key formatting
Change-Id: I155ec6f3e21075587dbcfdfdc346f28f958e3c15
2019-11-29 13:41:12 +01:00
Adam Wight 22a0350d84 [Refactor] Pass validation error with StatusValue
This has clearer semantics than checking for a `false` attribute.

Change-Id: I68f777eda40f8f157deafacaed02d4bd10cbf25c
2019-11-27 18:05:19 +01:00
Thiemo Kreuz 0013943a4a Rewrite argument parsing and use for both <ref> & <references>
We realized the trim() are not needed. This does not leave much behind
in the existing refArg() method, except that it checks for unknown keys.

I tried a few strategies and ended using the pretty new possibility to
have keys in list(), as well as use [] instead of list(). Both is
supported since PHP 7.1.

Change-Id: I569bfa14e68b64402519bd39022c197553881dde
2019-11-27 14:01:52 +01:00
Thiemo Kreuz 99d23ac841 Remove redundant attribute trimming
We noticed the group="…" attribute was the only one that was not
trimmed. Does this mean it was possible to have two groups "a" and
" a"? It turns out: no. This was never possible because the parser
already trims all attributes before calling this code.

I tried to come up with the worst possible test case, but it succeeds,
even with very old versions of this codebase.

I suggest to remove the extra trimming from this codebase and rely on
what the parser provides.

Note the content is special and *not* trimmed by default.

Change-Id: Idff015447d7156ba7b5c03a5c423f199a71349f2
2019-11-27 12:12:51 +00:00
Thiemo Kreuz 2ffcae0425 Add seperate unit test cases for Cite::testValidateRef()
Change-Id: I6008b834d18c2008304b51dd41f0387c28e53d94
2019-11-27 12:09:31 +01:00
Thiemo Kreuz 9f1521a773 Rename ambiguous tests to …UnitTest
These exist two times, one time in the unit/ folder as a unit test, and
another time in the parent folder as an integration test. This confused
me already several times.

Change-Id: I147b8af8a7edba2582496468b4878faecc6d8110
2019-11-27 11:15:39 +01:00
Renamed from tests/phpunit/unit/CiteTest.php (Browse further)