- All models now extend a generic Model class that extends Sudzy - Wrote tests for Subscriber and Setting model validation - Rewrote model tests to make sure they look the same - Updated both tests with cleanup logic in the beginning - Added test:unit-single method to Robo for selective unit testing Closes #54
32 lines
715 B
PHP
32 lines
715 B
PHP
<?php
|
|
namespace MailPoet\Models;
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class Setting extends Model {
|
|
public static $_table = MP_SETTINGS_TABLE;
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
|
|
$this->addValidations(
|
|
"name",
|
|
array("required" => "validation_option_name_blank",
|
|
"isString" => "validation_option_name_string",
|
|
"minLength|2" => "validation_option_name_length"
|
|
)
|
|
);
|
|
$this->addValidations(
|
|
"value",
|
|
array("required" => "validation_option_value_blank",
|
|
"isString" => "validation_option_value_string",
|
|
"minLength|2" => "validation_option_value_length"
|
|
)
|
|
);
|
|
|
|
}
|
|
|
|
}
|