Ivan - Fix issues with mail templating and add it to ruby tests [skip ci]
This commit is contained in:
parent
4ccbd75759
commit
3f01526814
|
@ -12,7 +12,7 @@ class MailTemplate extends DataStore {
|
||||||
|
|
||||||
$bean = RedBean::findOne(MailTemplate::TABLE, 'type = :type AND language = :language', array(
|
$bean = RedBean::findOne(MailTemplate::TABLE, 'type = :type AND language = :language', array(
|
||||||
':type' => $type,
|
':type' => $type,
|
||||||
':language' => $globalLanguage
|
':language' => $globalLanguage->value
|
||||||
));
|
));
|
||||||
|
|
||||||
return ($bean) ? new MailTemplate($bean) : null;
|
return ($bean) ? new MailTemplate($bean) : null;
|
||||||
|
@ -22,6 +22,7 @@ class MailTemplate extends DataStore {
|
||||||
return [
|
return [
|
||||||
'type',
|
'type',
|
||||||
'subject',
|
'subject',
|
||||||
|
'language',
|
||||||
'body'
|
'body'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Setting extends DataStore {
|
||||||
const TABLE = 'setting';
|
const TABLE = 'setting';
|
||||||
|
|
||||||
public static function getSetting($name) {
|
public static function getSetting($name) {
|
||||||
return parent::getDataStore('name', $name);
|
return parent::getDataStore($name, 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getProps() {
|
public static function getProps() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ include_once 'tests/__mocks__/ResponseMock.php';
|
||||||
include_once 'tests/__mocks__/ControllerMock.php';
|
include_once 'tests/__mocks__/ControllerMock.php';
|
||||||
include_once 'tests/__mocks__/SessionMock.php';
|
include_once 'tests/__mocks__/SessionMock.php';
|
||||||
include_once 'tests/__mocks__/UserMock.php';
|
include_once 'tests/__mocks__/UserMock.php';
|
||||||
include_once 'models/ERRORS.php';
|
include_once 'data/ERRORS.php';
|
||||||
|
|
||||||
include_once 'controllers/user/login.php';
|
include_once 'controllers/user/login.php';
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ require './libs.rb'
|
||||||
require './scripts.rb'
|
require './scripts.rb'
|
||||||
|
|
||||||
# TESTS
|
# TESTS
|
||||||
|
require './system/init-settings.rb'
|
||||||
require './user/signup.rb'
|
require './user/signup.rb'
|
||||||
require './user/login.rb'
|
require './user/login.rb'
|
||||||
require './user/send-recover-password.rb'
|
require './user/send-recover-password.rb'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
def request(path, data)
|
def request(path, data = {})
|
||||||
uri = URI('http://localhost:8080' + path)
|
uri = URI('http://localhost:8080' + path)
|
||||||
response = Net::HTTP.post_form(uri, data)
|
response = Net::HTTP.post_form(uri, data)
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ end
|
||||||
|
|
||||||
class Database
|
class Database
|
||||||
def initialize()
|
def initialize()
|
||||||
mysqlUser = ENV['MYSQL_USER'] || 'root';
|
mysqlUser = ENV['MYSQL_USER'] || 'root'
|
||||||
mysqlPass = ENV['MYSQL_PASSWORD'] || '';
|
mysqlPass = ENV['MYSQL_PASSWORD'] || ''
|
||||||
@connection = Mysql.new('localhost', mysqlUser , mysqlPass, 'development')
|
@connection = Mysql.new('localhost', mysqlUser , mysqlPass, 'development')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
describe '/system/init-settings' do
|
||||||
|
it 'should initialize correctly' do
|
||||||
|
result = request('/system/init-settings')
|
||||||
|
|
||||||
|
lang = $database.getRow('setting', 'language', 'name')
|
||||||
|
|
||||||
|
(result['status']).should.equal('success')
|
||||||
|
(lang['value']).should.equal('en')
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue