-
Notifications
You must be signed in to change notification settings - Fork 114
Phrases must not exceed 60chrs each #335
Phrases must not exceed 60chrs each #335
Conversation
…new bin, both at the web UI and further down the stack.
… to throw an exception in addition to an error message for humans. This is a risky move up the stack I might think, if it is not caught under normal operations.
… to throw an exception in addition to an error message for humans. This is a risky move up the stack I might think, if it is not caught under normal operations.
…com/xmacex/dmi-tcat into phrases_must_not_exceed_60chrs_each
… procrastination commit under cognitive stress of getting all the tests in place. Please bear with me.
…ctionality in modify_bin() too. On the UI side the same validateQuery() is used as when making a new bin, so I that should be fine.
…0chrs limit on phrases.
…ing on a more substantial task of adding tests in TDD style. Feedback provided by PHP Code Sniffer with default settings.
… is not an OOP project.
…ong because there is too much whitespace in the middle of it.
… 60 characters long, even some weird ones.
I've implemented checks against the 60 character limit per query in |
Ok phew my assumptions were not ludicrous. howdonamesevenwork:dmi-tcat $ find . -name '*.php' -exec egrep -l 'validate_capture_phrases' \{\} \;;
./capture/search/search.php
./tests/common/functionsTest.php
./common/functions.php
howdonamesevenwork:dmi-tcat $ Of which the last one only has its definition, the second one is in the test suite. As things currently stand, the only occurrence of calling it is dmi-tcat/capture/search/search.php Line 34 in 09e31a9
|
…m locally though, but not committing.
…e format familiar from the Twitter UI with disjunctions marked by ' OR ' instead of the comma ',' as the query bin manager thing on TCAT. Updated tests pass (hmm how can I have a test suite that I can commit to, but that does not get pushed to the repo? Maybe a separate project outside of the dmi-tcat top directory or something. Anyway...).
Whoops I notice a merge conflict has appeared 👀. Was it always there? |
"Whoops I notice a merge conflict has appeared 👀. Was it always there?" ... the trim function was replaced by the sanitise function in between. I resolved the conflict. Sorry for the long silence, we are currently cleaning up the repo and hope to merge open pull requests as soon as possible :) |
I believe this fixes #334. In general I do not feel very confident about this PR, but I want to contribute 😄 . I hope someone more familiar with the TCAT codebase reviews this PR. Comments are of course welcome, and I'll do my best to incorporate them.
I provide a couple of tests for this under a new top-level directory tests. There is an element of danger here, if the tests are run on a live TCAT installation where test data might trickle down to the database. Some PHPUnit database setup and fixtures ought to used to insulate these tests from live data.
Sorry I could not provide tests for the UI check and in Javascript function
validateQuery(query,type)
For my own purposes, I isolated the function intovalidateQuery.js
and my test suite with Jest is the followingpackage.json
this
jest.config.js
and the following
validateQuery.test.js
And then
npm test
yields