Skip to content

Commit

Permalink
Integration Tests: Add emailtest.php template for owncloud 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zuazo committed Sep 19, 2015
1 parent e43ddf2 commit fb46d71
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/cookbooks/owncloud_test/recipes/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

try {
require_once 'lib/base.php';

$defaults = new \OC_Defaults();
$mailer = \OC::$server->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);
}

0 comments on commit fb46d71

Please sign in to comment.