Skip to content

Commit

Permalink
ActivityTest - Update to pass on Standalone
Browse files Browse the repository at this point in the history
Before
------

If you run this test on Standalone, it fails: like so

```
CRM_Activity_BAO_ActivityTest::testSendEmailWillReplaceTokensUniquelyForEachContact3
Exception: CRM_Core_Exception: "rename(/home/homer/buildkit/build/build-1/web/public/custom/test_email_create.txt,
/home/homer/buildkit/build/build-1/web/private/attachment//test_email_create.txt): No such file or directory"
 #0 /home/homer/buildkit/build/build-1/web/core/CRM/Contact/Form/Task/EmailTrait.php(867): civicrm_api3("Activity", "create", (Array:9))
 #1 /home/homer/buildkit/build/build-1/web/core/CRM/Contact/Form/Task/EmailTrait.php(788): CRM_Contact_Form_Task_Email->createEmailActivity(6, "subject:Mr. Joe Red II", "html:Mr. Joe Red II", "text:Mr. Joe Red II {$contact.first_name}", "", 1, (Array:1), NULL)
...

After
-----

Passes

Comments
--------

I believe this makes standalone behave the same way as Drupal.

However, the underlying scenario is a bit weird -- it seems that `rename()`
puts the file into the same place where it already is. Which is weird.

If the purpose is to create an example file and put it through the same paces as
day-to-day workflows, then you'd probably need to put the sample file somewhere
else (like sys_get_temp_dir()).
  • Loading branch information
totten committed Aug 29, 2024
1 parent 17894a4 commit 483fe55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/phpunit/CRM/Activity/BAO/ActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ public function testSendEmailWillReplaceTokensUniquelyForEachContact3(): void {
// Check the smarty doesn't mess stuff up.
$text = 'text:' . '{contact.display_name} {$contact.first_name}';

$filepath = Civi::paths()->getPath('[civicrm.files]/custom');
$filepath = CRM_Core_Config::singleton()->customFileUploadDir;
$fileName = 'test_email_create.txt';
$fileUri = "{$filepath}/{$fileName}";
// Create a file.
Expand Down Expand Up @@ -1778,7 +1778,7 @@ public function testSendEmailDoesNotDuplicateAttachmentFileIDsForActivitiesCreat
$html = __FUNCTION__ . ' html';
$text = __FUNCTION__ . ' text';

$filepath = Civi::paths()->getPath('[civicrm.files]/custom');
$filepath = CRM_Core_Config::singleton()->customFileUploadDir;
$fileName = 'test_email_create.txt';
$fileUri = "{$filepath}/{$fileName}";
// Create a file.
Expand Down

0 comments on commit 483fe55

Please sign in to comment.