Skip to content
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

[NFC] Unit test for file-on-case #21678

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

demeritcowboy
Copy link
Contributor

Overview

I thought there was a test for this but I don't see one exactly like it.

Before

No test

After

Test

Technical Details

There's a variation of file-on-case where you can create a regular activity and put [case #N] in the subject and it's a shortcut to then filing it after via the button. It's a bit like the email processor where it will do the same thing if the subject has that.

Comments

Is test

@civibot
Copy link

civibot bot commented Sep 30, 2021

(Standard links)

@eileenmcnaughton
Copy link
Contributor

thanks @demeritcowboy

@demeritcowboy
Copy link
Contributor Author

Hmm, I think the test fail is a form of pollution from an earlier test since it passes on its own locally. Will figure it out.

CRM_Case_Form_ActivityTest::testFileOnCaseBySubject
Exception: CRM_Core_Exception: "Case does not have a recognized case-type!"
#0 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/Civi/CCase/Events.php(98): Civi\CCase\Analyzer->getCaseType()
#1 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(214): Civi\CCase\Events::delegateToXmlListeners(Object(Civi\CCase\Event\CaseChangeEvent), "hook_civicrm_caseChange", Object(Civi\Core\CiviEventDispatcher))
#2 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:3), "hook_civicrm_caseChange", Object(Civi\CCase\Event\CaseChangeEvent))
#3 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(198): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_caseChange", Object(Civi\CCase\Event\CaseChangeEvent))
#4 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/CRM/Utils/Hook.php(2512): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_caseChange", Object(Civi\CCase\Event\CaseChangeEvent))
#5 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/Civi/CCase/Events.php(84): CRM_Utils_Hook::caseChange(Object(Civi\CCase\Analyzer))
#6 [internal function](): Civi\CCase\Events::fireCaseChangeForRealz("1")
#7 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/Civi/Core/Transaction/Frame.php(198): call_user_func_array((Array:2), (Array:1))
#8 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/Civi/Core/Transaction/Frame.php(148): Civi\Core\Transaction\Frame->invokeCallbacks(2)
#9 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/Civi/Core/Transaction/Manager.php(103): Civi\Core\Transaction\Frame->finish()
#10 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/CRM/Core/Transaction.php(126): Civi\Core\Transaction\Manager->dec()
#11 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/CRM/Case/BAO/Case.php(115): CRM_Core_Transaction->commit()
#12 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/CRM/Case/Form/Case.php(361): CRM_Case_BAO_Case::create((Array:13))
#13 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/CRM/Case/Form/Case.php(327): CRM_Case_Form_Case->submit((Array:13))
#14 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php(3787): CRM_Case_Form_Case->testSubmit((Array:13), "OpenCase", 3, "standalone")
#15 /home/jenkins/bknix-dfl/build/core-21678-1k0v/web/sites/all/modules/civicrm/tests/phpunit/CRM/Case/Form/ActivityTest.php(26): CiviUnitTestCase->createCase(4, 3)

@demeritcowboy
Copy link
Contributor Author

Ok so I can reproduce the fail if I run tests on the whole CRM/Case folder. I can't figure out what the problem is and I've already spent more time on this than I wanted to and probably shortened my hard drive lifespan running so many tests, so I've just moved the test into the BAO test file even though it's not a BAO thing. The note in setUp() there suggests something is off with how CiviCase gets set up/torn down but maybe can punt to a future todo?

@eileenmcnaughton
Copy link
Contributor

Future todos rule the world

@eileenmcnaughton eileenmcnaughton merged commit 26bde41 into civicrm:master Oct 1, 2021
@demeritcowboy demeritcowboy deleted the test-fileoncase branch October 1, 2021 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants