Commit graph

145 commits

Author SHA1 Message Date
20ff08a431 Implement TTTRSS getCounters operation; fixes #79 2017-10-11 12:55:50 -04:00
c9c6891567 Implement TTRSS getCategories; fixes #81 2017-10-07 12:46:05 -04:00
7a2de95c70 Consolidate article context handling into articleQuery function
Also consolidated article star counting into a generic articleCount function which accepts a context.

This may lead to slight efficiency losses in either listing or marking (and more significant ones in counting starred), but the advantages of centralized context handling are significant with the future addition of labels and the need to count articles under various future contexts in TTRSS.
2017-10-06 20:26:22 -04:00
26f6922b25 Partially implement labels
- Backend functions for adding, listing, removing, and editing (renaming) labels currently implemented
- TTRSS functions for adding (fixes #96), removing (fixes #97), and renaming (fixes #98) labels currently implemented
2017-10-05 17:42:12 -04:00
03d5d554a9 Imple TTRSS functions getUnread and getConfig
- Fixes #78
- Fixes #85
2017-10-03 12:43:46 -04:00
97b0134e56 Merge master 2017-10-02 15:42:15 -04:00
a80e283abc Perform feed discovery correctly; fixes #118 2017-10-02 11:53:52 -04:00
0a0aabe4ed Merge master 2017-09-30 12:52:05 -04:00
3482a35e54 Implement feed discovery; fixes #110 2017-09-30 11:43:43 -04:00
5488b994f7 Merged master; CS fixes 2017-09-28 10:16:24 -04:00
96ebf936e4 CS fixes 2017-09-28 09:01:43 -04:00
5ebf6cb689 Treat objects which are convertible to strings the same as actual strings in ValueInfo 2017-09-28 08:55:47 -04:00
d365529493 Multiple fixes to input sanitization
- Database functions now accept any input, but throw typeViolation exceptions where appropriate instead of idMissing or subjectMissing
- Added unit tests for the new Misc\ValueInfo static class
- Added ValueInfo::id() method to centrally validate database IDs, and made use of it consistently
- Made use of PHP's filter_var() function where appropriate when validating or sanitizing input
- Made the NCN protocol handler reject most invalid IDs before handing off to method handlers
- Made NCN's feedUpdate and subscriptionMove methods return 422 on invalid input
- Adjusted several tests to handler type violations
2017-09-27 22:25:45 -04:00
7b121c74ec Merge fixes from master 2017-09-26 20:25:11 -04:00
e74a3ae3cb Fix numerous bugs when adding or changing folders
- Specifying a non-integer parent no longer silently casts to 0 or 1
- Specifying a folder ID of 0 now always converts to null automatically
- Performing both a rename and move to root in the same operation no longer results in potential duplicates
- Calling folderSetProperties with an empty data array no peforms an update; it now returns false before the update call
- Modification timestamps are now actually updated when a folder is modified
- Constraint violation exceptions triggered by code (rather than the database) now print a message
- Renaming a folder or subscription to a non-string value (e.g. an array) throws an exception rather than silently casting
- Added tests to better cover all the above
- Centralized the normalization of integers and title strings into a new ValueInfo static class
2017-09-26 16:45:41 -04:00
91432d4e16 Tests for sessions 2017-09-24 12:45:07 -04:00
f7e50fe95d Passed code through linter 2017-08-29 10:50:31 -04:00
14951e2e4f Chnage "retain" settings to mean "purge; remove unused database settings 2017-08-20 15:46:35 -04:00
52104fb647 Implement article cleanup; fixes #28 2017-08-17 22:36:15 -04:00
eeb834fe4c Record the size of feeds upon update
Used to retain at least N articles when cleaning up, so that very infrequently changed feeds do not have their most recent articles purged
2017-08-14 20:07:31 -04:00
67203679aa Changed foreign key on marks table
Previously arsse_marks had a reference to arsse_users along with arsse_articles; the former has now changed to arsse_subscriptions.

Consequently deleting a subscription now deletes marks. Tests have been simplified as a consequence.

This change was understaken to simplify counting valid marks on articles for the purposes of article cleanup; now all marks are valid marks
2017-08-14 17:18:18 -04:00
3b018c89d1 Implemented cleanup of orphaned feeds; fixes #25 2017-08-02 18:27:04 -04:00
4066bba05e Full code coverage for Database class
- Fixes #49
2017-07-22 23:08:08 -04:00
da80a8ffa6 Complete tests for database driver
- Fixes #62
2017-07-22 15:29:12 -04:00
cbdcacd1c3 Added basic code coverage annotations 2017-07-20 18:36:03 -04:00
3a26c75044 Tests for Database::meta*() functions
Improves #49
2017-07-18 16:38:23 -04:00
da092d5f8c Changed Misc\DateFormatter to a collection of static methods and renamed it to Date; renamed Data to Arsse to avoid confusion and better reflect its centrality 2017-07-17 07:47:57 -04:00
d4674c61b2 More bug fixes
- use DateFormatter throughout the Feed class
- Ensure dates have TEXT affinity in SQLite, in case it matters
- Add a userPreAuth setting for when relying on the Web server to do authentication
2017-07-15 13:33:17 -04:00
ac73ed0e7f More tweaks
- Changed Data::$l to Data::$lang; it's not used enough to justify the possibly confusing shortening
- Made database auto-update a general rather than per-driver setting
- Added settings for forthcoming feed fetching service
2017-07-11 20:27:37 -04:00
eacada3982 Fix ISO 8601 format strings 2017-07-09 18:31:03 -04:00
b3f631e335 Use more reliable database locking strategy; reorganize tests
PostgreSQL and MySQL both have better locking mechanisms than what was previously implemented, as well
2017-07-07 21:06:38 -04:00
17ec6cf669 Move date formatting out of SQL and standardize on the DateFormatter trait
Fixes #56
2017-07-07 15:25:47 -04:00
761c1054f3 Added context options to mark multiple specific articles or editions
This required significant rewrites of queries because of stale editions
2017-07-06 22:53:17 -04:00
c51ee594aa Last of the article series of tests 2017-07-05 10:59:13 -04:00
d78318bed7 Last of marking context tests 2017-07-05 09:09:38 -04:00
5742d949cc More article marking tests, some context tests
Various fixes as a result
2017-06-30 13:53:19 -04:00
c2f60bc5d2 More article tests
- Test the values returned by articleList
- Test paged and reversed listing
- Test marking, un/read, un/starred, and both
- Nearly complete rewrite of marking queries; previous efforts simply did not work, or overzealously updated or inserted
- Testing of marking contexts still required
2017-06-29 23:56:43 -04:00
ee9d8c1ceb First tests for articleList
Fixed many errors in queries:
- Prepared statement wasn't running at all :)
- Returning feed ID rather than subscription ID
- latestEdition wasn't matching
2017-06-22 13:07:56 -04:00
7e458dddbc More test re-organization 2017-06-18 12:48:29 -04:00
845b47e656 Re-organize test data for Database tests 2017-06-18 12:24:19 -04:00
dd24246f49 Finished last of feedUpdate tests; implemented NCN API functions
- Fixes #26
- Fixes #27
2017-06-03 17:34:37 -04:00
0514321a76 Save enclosures and categories properly in feedUpdate 2017-06-03 14:08:33 -04:00
c6b7e653c5 Tests for feedUpdate and feedListStale
The update process neglects to handle enclosures; this will have to be fixed
2017-06-02 19:16:36 -04:00
78e669fbfc Improvements to database test harness 2017-06-02 14:12:36 -04:00
81419452b5 Added topmost folder to output of subscriptionList. Fixes #54
- Adjusted NCN handler to use the topmost folder for folderId; suppressed the actual folder so as not to pollute output with non-standard data
- Updated tests
2017-06-01 18:12:08 -04:00
719290c82a Remove dependency on Webmozart's Glob outside of testing
Native glob is effectively tested via use of unmodified Lang throughout non-Lang tests
2017-06-01 13:50:46 -04:00
c800852f3a Remove stubs to support non-HTTP authentication
Also removes authPreferHTTP setting
2017-05-26 13:06:06 -04:00
ceeb23aea3 More Feed tests: cache header handling
- Also made all SQLite tests skippable if the extension is not loaded
- Fixed format of ETags in test server
- Passed any CLI arguments to PHPUnit in the test runner
2017-05-22 10:02:36 -04:00
590abaf0ef Start on tests for Feed
- Makes use of PHP's internal Web server to deliver expected responses from a real server
- Windows batch file can be used to run tests (Linux and Mac test runners to come later)
- Added PHPUnit to dev dependencies
2017-05-21 17:16:32 -04:00
88c0f4986c Implement NCN API v1-2 feed handling: tests
- Fixes #8
- Fixes #9
- Fixes #10
- Fixes #11
- Fixes #12

- Differentiated between a missing ID which is the subject of an action (e.g. the subscription when moving a subscription) and other missing IDs (e.g. the folder when moving a subscription)
- Enforced same rules for subscription titles as for folder names, save that null is valid for subscriptions
2017-05-21 10:10:36 -04:00
4a816f827b NCNv1 feed calls and other changes
- Implemented all but one feed-related function (it's more ofan item function)
- Fixed time conversion for input into SQL; dates in PM were previously wrong
- Added miscellaneous tentative functions to Database to help with peculiarities of NCNv1; these may change
- Tests to come soon
2017-05-18 23:03:33 -04:00
0bc2841837 Last of subscription tests
- Also tweaked SQL dateformat() function to output proper HTTP dates
- Also introduced method to set a default output date format
2017-05-18 13:21:17 -04:00
99ae274ef8 Also test negative read marks 2017-05-16 22:24:36 -04:00
ef3cb4fa54 Test unread counts in subscriptionList 2017-05-16 22:19:40 -04:00
f635155687 Basic tests for subscription list
- Need entries and read marks to fully test
- Added assertion type to test result subsets
- Fixed custom subscription titles
2017-05-14 23:03:48 -04:00
acbb254bfb Tests for removing subscriptions 2017-05-11 23:20:10 -04:00
98c950de58 Removed most calls to userExists()
- functions not related to user management now have the existence of the affected user checked in the authorizer, when the affected user differs from the actor
- User::authorizationEnabled() now nests: disabling twice and then enabling once leaves the authorizer disabled
- Disabling of the authorizer is now tested
- User tests now use a partial mock instead of relying on User::authorizationEnabled()
- Added authorizer tests against a missing user
- Removed folder tests related to missing users
- Also added more subscription tests
2017-05-11 18:00:35 -04:00
a580579627 First set of Database subscription tests 2017-05-10 22:01:00 -04:00
554beacfdb Improved database tests
- Centralized initial state; this will be useful due to foreign key interdependence
- Added nextID() method to make insert tests less brittle
2017-05-10 21:21:23 -04:00
2083c6e397 Change transactions to auto-rollback on exceptions 2017-05-06 12:02:27 -04:00
fb922e65e4 Tests for strict binding 2017-05-04 19:38:54 -04:00
717e74fb2e Refactored special case for testing 2017-05-03 20:00:29 -04:00
a67fe30408 Fix whitespace
Also fixed my editor so tabs won't happen again!
2017-04-06 21:41:21 -04:00
19abce85c3 Implement NCN API v1-2 folder creation
- Fixes #4
- Tests for failure modes still required
2017-04-02 12:14:15 -04:00
842e277d43 Implemented NCN API v1-2 folder list
- Fixes #2
- Also re-organized REST handling
2017-04-01 23:06:52 -04:00
718c5a04dd Add authz verification to folder tests 2017-04-01 15:06:34 -04:00
1e1b848c62 Remove root field from folders table
The field is no longer required with the use of recursive common table expressions, and  presents a possible loss of referential integrity
2017-04-01 14:49:31 -04:00
a111bcc231 Folder get/set prop funcs and other changes
- Simplified folder removal; now properly relies on foreign keys for dependency resolution
- simplified *propertiesSet() methods by offloading input validation and query building to a generic function
- Implemented function to get the properties of a single folder (useful for internal use)
- Implemented a function to set the properties of a folder
2017-04-01 10:27:26 -04:00
2344911f78 Tests for removing folders 2017-03-31 18:48:24 -04:00
458eaac5c6 Tests for listing folders
- Fixed checking for existence of parent before listing
- Changed Result->getAll() to return an empty array rather than null for an empty result set
2017-03-31 17:42:28 -04:00
b68cea1188 Tests for adding folders 2017-03-31 15:27:59 -04:00
82e4838162 Re-organize Database tests
- Test files now consist entirely of traits:
 - General setup trait mocking User class and cleaning up
 - Driver trait to set up the database connection
 - Series trait containing tests for the series, independent of driver used
2017-03-31 13:24:00 -04:00
dbd735f1f3 Full set of tests for user-related Database funcs
- Fixed a few inconsistencies and bugs along the way
- User manager tests need some equivalent fleshing out
2017-03-29 23:41:05 -04:00
6b2be0a877 Use Phake to create mock objects in tests 2017-03-28 20:30:40 -04:00
6bb129db2f Mock correct method of Lang 2017-03-28 19:58:20 -04:00
f902346b6c Eliminated passing of RuntimeData instances
- RuntimeData has now been replaced by a single static Data class
- The Data class has a load() method which fills the same role as the constructor of RuntimeData
- The static Lang class is now an instantiable class and is a member of Data
- All tests have been adjusted and pass
- The Exception tests no longer require convoluted workarounds: a simple mock  for Data::$l suffices; Lang tests also use a mock to prevent loops now instead of using a workaround
2017-03-28 18:50:00 -04:00
2b8aa75ee3 Row index is not a string 2017-03-28 10:31:49 -04:00
7236020b8b Changed "NewsSync" to "Arsse" 2017-03-27 23:12:12 -05:00
9d5dab249c Helper methods for testing Database class
May not actually work yet
2017-03-27 23:19:05 -04:00
eeb1818bb5 Still more database changes
- Restructured tests
- Localized driver name for SQLite driver (fixes #37)
- Ensured that binding type definitions are required
2017-03-03 13:20:26 -05:00
007e3747ef Various database fixes
Authentication appears to be broken with a real database
2017-03-02 20:47:00 -05:00
0c410fcf50 More binding tests and related changes
- Introduced abstract Statement class to hold common methods
- Common methods currently consist of a date formatter and type caster
- Moved binding tests to a trait for reuse with future drivers
2017-03-02 18:42:19 -05:00
000781dc36 Cover blank passwords in existing tests 2017-02-27 23:28:11 -05:00
e4852b581a Start on tests for authorization 2017-02-27 23:04:13 -05:00
a039e104cf Allow inspection of the mock internal database
This will allow testing of auto-provisioning in the internal database when using external drivers
2017-02-27 11:44:20 -05:00
798d7e7ab7 Added synthetic tests for external User drivers
Fixed two typos in external driver handling
2017-02-26 22:06:14 -05:00
b6a47fc366 Abstract synthetic User backend for later tests 2017-02-26 12:09:44 -05:00
be9ebf9ca1 Remove authz from User driver; moved to main class 2017-02-22 23:22:45 -05:00
8a0d021622 More User tests and resultant fixes 2017-02-20 19:04:08 -05:00
7785eb072b Complete rewrite of User class and other changes
- User-related database methods will now throw User\Exception upon errors
- Internal userAdd method can now generate random passwords
- Pursuant to above, dependency on password genrator has been added, and password-related methods now return strings instead of booleans
- User class methods now all explicitly follow different branches for internal/external/missing implementations
- various User class methods now perform auto-provisioning of the internal database when external implementations report success on users not in the database
- Tests have been adjusted to account for the above changes
- Lots is probably still broken
2017-02-20 17:04:13 -05:00
e6feb8de8d First basic test for User class
As the User class depends on the database and this has yet to be tested (though I'm fairly certain it works), the mock driver also acts as a mock of the required database functions, with both instances sharing a common storage structure. Later test series should separate the two.
2017-02-19 00:22:16 -05:00
574388665a Tidy up tests and User stuff
- Skeleton of mock internal driver
- Skeleton of test suite
- Re-arranged lots of code
- Made drive name localized (improves #37)
2017-02-17 19:22:50 -05:00
8db31cf3e4 Tweaked Lang; added comments and tests
Tweaks:
- get() method can now report loaded and well as wanted locale
- msg() passed without vars still gets formatted to catch malformed strings
- set('en', false) followed by set('en', true) will now immediately load
- Lang::$synched was not getting set to true properly

Tests:
- Added test for get()
- Added test for malformed strings (exception code was missing)
- Added test for missing strings
- Added test for strings taking variables not being passed any variables
2017-02-16 17:50:34 -05:00
c5fac33398 Converted all hard tabs to soft tabs 2017-02-16 14:29:42 -06:00
8e2a2c46b1 Refactor test infrastructure to use PSR-4. 2017-02-14 22:34:08 -05:00