The nginx fix is required for macos.
Details
- Reviewers
machniak - Group Reviewers
Restricted Project - Commits
- rK0d94a225dd77: Added infrastructure tests for Activesync/CalDav/WOPI/Roundcube & fixed the…
rK8351b8603400: Added infrastructure tests for Activesync/CalDav/WOPI/Roundcube & fixed the…
rK2c2179806394: Added infrastructure tests for our Activesync/CalDav/wopi infrastructure
Diff Detail
- Repository
- rK kolab
- Lint
Lint Errors Severity Location Code Message Error src/tests/Infrastructure/ActivesyncTest.php:18 phpstan Instantiated class Syncroton_Wbxml_Encoder not found. Error src/tests/Infrastructure/ActivesyncTest.php:21 phpstan Call to method encode() on an unknown class Syncroton_Wbxml_Encoder. Error src/tests/Infrastructure/ActivesyncTest.php:31 phpstan Instantiated class Syncroton_Wbxml_Decoder not found. Error src/tests/Infrastructure/ActivesyncTest.php:32 phpstan Call to method decode() on an unknown class Syncroton_Wbxml_Decoder. Error src/tests/Infrastructure/DavTest.php:97 phpstan Unreachable statement - code above always terminates. - Unit
No Test Coverage - Build Status
Buildable 41267 Build 16550: arc lint + arc unit
Event Timeline
Test cleanup to work with test users.
Now includes an nginx fix because the commits were too cumbersome to untangle.
src/tests/Infrastructure/ActivesyncTest.php | ||
---|---|---|
47 | I suppose this common code could be moved to getTestUser() (optional). Also, we should not use LDAP::createUser() if LDAP is disabled. | |
70 | Should we use setUpBeforeClass() if we use tearDownAfterClass()? Also, we definitely want to remove the created user. | |
111 | Debug code. | |
src/tests/Infrastructure/AutodiscoverTest.php | ||
18 | This too needs to be configurable. The chwala and webmail locations too. Then maybe instead of creating a separate config file for each "self" service we should put them somewhere together, e.g. in services.php or another file? | |
src/tests/Infrastructure/DavTest.php | ||
52 | Just use $this->deleteTestUser($this->user->email). |
src/tests/Infrastructure/ActivesyncTest.php | ||
---|---|---|
70 | They are static so I can't set member variables. That's why I ended up using setUp. | |
src/tests/Infrastructure/AutodiscoverTest.php | ||
18 | I understand the sentiment, but until we actually use the configs elsewhere I don't think it matters (which is why I didn't do it in the first place). I like the idea of having a services.php file, and another variable in there also doesn't hurt, so I'll do that. | |
src/tests/Infrastructure/DavTest.php | ||
52 | tearDownAfterClass is a static function. |
src/tests/TestCaseTrait.php | ||
---|---|---|
587 ↗ | (On Diff #11510) | I thought this works, but it doesn't. phpunit seems to sometimes reinstantiate the entire class between runs (member variables are lost), and beforeApplicationDestroyed is called on every tearDown(). So, phpunit makes it impossible to implement a setup first, run all tests, teardown last appraoch. I'm going to stuff all tests into a single test function and be done with it. |
This is what I've arrived at.
Unfortunately it's just not really possible I think to implement the user setup/teardown in a sensible fashion in phpunit without more intrusive changes.
The crux is that the laravel integration uses setUp/tearDown to setup and teardown the laravel framework, so outside of it we just can't really do anything (no db interaction anyways).
So we're stuck with lazy initialization, plus using a test and relying on the default ordering for teardown.
This now at least works.
In the process I also found an issue with the activesync test that would always return no folders, which I tracked to the initialization not being run after the account removal + creation,
because syncroton already knew the deviceid, it assumed the initial setup was done, but the metadata was empty of course (resulting in all folders being filtered including inbox).
Fixed by using a random deviceid.