From fb46d71856fde35d0f758ac91cf1f9c310dab996 Mon Sep 17 00:00:00 2001 From: Xabier de Zuazo Date: Sat, 19 Sep 2015 20:30:00 +0200 Subject: [PATCH] Integration Tests: Add emailtest.php template for owncloud 8.1 --- test/cookbooks/owncloud_test/recipes/common.rb | 5 +++++ .../templates/default/emailtest-8.1.php.erb | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/cookbooks/owncloud_test/templates/default/emailtest-8.1.php.erb diff --git a/test/cookbooks/owncloud_test/recipes/common.rb b/test/cookbooks/owncloud_test/recipes/common.rb index 036efb1..45ffd91 100644 --- a/test/cookbooks/owncloud_test/recipes/common.rb +++ b/test/cookbooks/owncloud_test/recipes/common.rb @@ -25,6 +25,11 @@ include_recipe 'owncloud' template 'emailtest.php' do + if Chef::VersionConstraint.new('< 8.1').include?(node['owncloud']['version']) + source 'emailtest.php.erb' + else + source 'emailtest-8.1.php.erb' + end path ::File.join(node['owncloud']['dir'], 'emailtest.php') source 'emailtest.php.erb' mode 00644 diff --git a/test/cookbooks/owncloud_test/templates/default/emailtest-8.1.php.erb b/test/cookbooks/owncloud_test/templates/default/emailtest-8.1.php.erb new file mode 100644 index 0000000..06052b9 --- /dev/null +++ b/test/cookbooks/owncloud_test/templates/default/emailtest-8.1.php.erb @@ -0,0 +1,18 @@ +getMailer(); + $message = $mailer->createMessage(); + $message->setTo(['root@localhost.localdomain' => 'root']); + $message->setSubject('Email Sending Test'); + $message->setPlainBody('Email Sending Test'); + $message->setFrom([ + \OCP\Util::getDefaultEmailAddress('kitchen-test') => $defaults->getName() + ]); + $mailer->send($message); +} catch (Exception $ex) { + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); +}