Renamed Alphanumeric type class to Text.
This commit is contained in:
parent
05c751440b
commit
388a079834
22 changed files with 69 additions and 69 deletions
|
@ -11,7 +11,7 @@
|
|||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
use \EA\Engine\Types\Alphanumeric;
|
||||
use \EA\Engine\Types\Text;
|
||||
use \EA\Engine\Types\Email;
|
||||
use \EA\Engine\Types\Url;
|
||||
|
||||
|
@ -203,7 +203,7 @@ class Appointments extends CI_Controller {
|
|||
if ($send_provider === TRUE) {
|
||||
$email->sendDeleteAppointment($appointment, $provider,
|
||||
$service, $customer, $company_settings, new Email($provider['email']),
|
||||
new Alphanumeric($_POST['cancel_reason']));
|
||||
new Text($_POST['cancel_reason']));
|
||||
}
|
||||
|
||||
$send_customer = filter_var($this->settings_model->get_setting('customer_notifications'),
|
||||
|
@ -212,7 +212,7 @@ class Appointments extends CI_Controller {
|
|||
if ($send_customer === TRUE) {
|
||||
$email->sendDeleteAppointment($appointment, $provider,
|
||||
$service, $customer, $company_settings, new Email($customer['email']),
|
||||
new Alphanumeric($_POST['cancel_reason']));
|
||||
new Text($_POST['cancel_reason']));
|
||||
}
|
||||
|
||||
} catch(Exception $exc) {
|
||||
|
@ -431,16 +431,16 @@ class Appointments extends CI_Controller {
|
|||
$email = new \EA\Engine\Notifications\Email($this, $this->config->config);
|
||||
|
||||
if ($post_data['manage_mode'] == FALSE) {
|
||||
$customer_title = new Alphanumeric($this->lang->line('appointment_booked'));
|
||||
$customer_message = new Alphanumeric($this->lang->line('thank_you_for_appointment'));
|
||||
$provider_title = new Alphanumeric($this->lang->line('appointment_added_to_your_plan'));
|
||||
$provider_message = new Alphanumeric($this->lang->line('appointment_link_description'));
|
||||
$customer_title = new Text($this->lang->line('appointment_booked'));
|
||||
$customer_message = new Text($this->lang->line('thank_you_for_appointment'));
|
||||
$provider_title = new Text($this->lang->line('appointment_added_to_your_plan'));
|
||||
$provider_message = new Text($this->lang->line('appointment_link_description'));
|
||||
|
||||
} else {
|
||||
$customer_title = new Alphanumeric($this->lang->line('appointment_changes_saved'));
|
||||
$customer_message = new Alphanumeric('');
|
||||
$provider_title = new Alphanumeric($this->lang->line('appointment_details_changed'));
|
||||
$provider_message = new Alphanumeric('');
|
||||
$customer_title = new Text($this->lang->line('appointment_changes_saved'));
|
||||
$customer_message = new Text('');
|
||||
$provider_title = new Text($this->lang->line('appointment_details_changed'));
|
||||
$provider_message = new Text('');
|
||||
}
|
||||
|
||||
$customer_link = new Url(site_url('appointments/index/' . $appointment['hash']));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
use \EA\Engine\Types\Alphanumeric;
|
||||
use \EA\Engine\Types\Text;
|
||||
use \EA\Engine\Types\Email;
|
||||
use \EA\Engine\Types\Url;
|
||||
|
||||
|
@ -295,15 +295,15 @@ class Backend_api extends CI_Controller {
|
|||
->get_setting('notifications', $provider['id']);
|
||||
|
||||
if (!$manage_mode) {
|
||||
$customer_title = new Alphanumeric($this->lang->line('appointment_booked'));
|
||||
$customer_message = new Alphanumeric($this->lang->line('thank_you_for_appointment'));
|
||||
$provider_title = new Alphanumeric($this->lang->line('appointment_added_to_your_plan'));
|
||||
$provider_message = new Alphanumeric($this->lang->line('appointment_link_description'));
|
||||
$customer_title = new Text($this->lang->line('appointment_booked'));
|
||||
$customer_message = new Text($this->lang->line('thank_you_for_appointment'));
|
||||
$provider_title = new Text($this->lang->line('appointment_added_to_your_plan'));
|
||||
$provider_message = new Text($this->lang->line('appointment_link_description'));
|
||||
} else {
|
||||
$customer_title = new Alphanumeric($this->lang->line('appointment_changes_saved'));
|
||||
$customer_message = new Alphanumeric('');
|
||||
$provider_title = new Alphanumeric($this->lang->line('appointment_details_changed'));
|
||||
$provider_message = new Alphanumeric('');
|
||||
$customer_title = new Text($this->lang->line('appointment_changes_saved'));
|
||||
$customer_message = new Text('');
|
||||
$provider_title = new Text($this->lang->line('appointment_details_changed'));
|
||||
$provider_message = new Text('');
|
||||
}
|
||||
|
||||
$customer_link = new Url(site_url('appointments/index/' . $appointment['hash']));
|
||||
|
@ -410,7 +410,7 @@ class Backend_api extends CI_Controller {
|
|||
if ((bool)$send_provider === TRUE) {
|
||||
$email->sendDeleteAppointment($appointment, $provider,
|
||||
$service, $customer, $company_settings, new Email($provider['email']),
|
||||
new Alphanumeric($_POST['delete_reason']));
|
||||
new Text($_POST['delete_reason']));
|
||||
}
|
||||
|
||||
$send_customer = $this->settings_model->get_setting('customer_notifications');
|
||||
|
@ -418,7 +418,7 @@ class Backend_api extends CI_Controller {
|
|||
if ((bool)$send_customer === TRUE) {
|
||||
$email->sendDeleteAppointment($appointment, $provider,
|
||||
$service, $customer, $company_settings, new Email($customer['email']),
|
||||
new Alphanumeric($_POST['delete_reason']));
|
||||
new Text($_POST['delete_reason']));
|
||||
}
|
||||
} catch(Exception $exc) {
|
||||
$warnings[] = exceptionToJavaScript($exc);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
use \EA\Engine\Types\Email;
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ class User extends CI_Controller {
|
|||
'company_email' => $this->settings_model->get_setting('company_email')
|
||||
);
|
||||
|
||||
$email->sendPassword(new NonEmptyAlphanumeric($new_password), new Email($_POST['email']), $company_settings);
|
||||
$email->sendPassword(new NonEmptyText($new_password), new Email($_POST['email']), $company_settings);
|
||||
}
|
||||
|
||||
echo ($new_password != FALSE) ? json_encode(AJAX_SUCCESS) : json_encode(AJAX_FAILURE);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* @since v1.2.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* API V1 Controller
|
||||
|
@ -41,8 +41,8 @@ class API_V1_Controller extends CI_Controller {
|
|||
parent::__construct();
|
||||
|
||||
try {
|
||||
$username = new NonEmptyAlphanumeric($_SERVER['PHP_AUTH_USER']);
|
||||
$password = new NonEmptyAlphanumeric($_SERVER['PHP_AUTH_PW']);
|
||||
$username = new NonEmptyText($_SERVER['PHP_AUTH_USER']);
|
||||
$password = new NonEmptyText($_SERVER['PHP_AUTH_PW']);
|
||||
$authorization = new \EA\Engine\Api\V1\Authorization($this);
|
||||
$authorization->basic($username, $password);
|
||||
} catch(\Exception $exception) {
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Admins Controller
|
||||
|
@ -88,7 +88,7 @@ class Admins extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->admins_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch (\Exception $exception) {
|
||||
$this->_handleException($exception);
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Appointments Controller
|
||||
|
@ -88,7 +88,7 @@ class Appointments extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->appointments_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch(\Exception $exception) {
|
||||
exit($this->_handleException($exception));
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Categories Controller
|
||||
|
@ -88,7 +88,7 @@ class Categories extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->services_model->get_all_categories('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch (\Exception $exception) {
|
||||
$this->_handleException($exception);
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Customers Controller
|
||||
|
@ -88,7 +88,7 @@ class Customers extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->customers_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch (\Exception $exception) {
|
||||
$this->_handleException($exception);
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Providers Controller
|
||||
|
@ -88,7 +88,7 @@ class Providers extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->providers_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch (\Exception $exception) {
|
||||
$this->_handleException($exception);
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Secretaries Controller
|
||||
|
@ -88,7 +88,7 @@ class Secretaries extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->secretaries_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch (\Exception $exception) {
|
||||
$this->_handleException($exception);
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Services Controller
|
||||
|
@ -88,7 +88,7 @@ class Services extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->services_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch (\Exception $exception) {
|
||||
$this->_handleException($exception);
|
||||
|
|
|
@ -15,7 +15,7 @@ require_once __DIR__ . '/API_V1_Controller.php';
|
|||
|
||||
use \EA\Engine\Api\V1\Response;
|
||||
use \EA\Engine\Api\V1\Request;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* Unavailabilities Controller
|
||||
|
@ -88,7 +88,7 @@ class Unavailabilities extends API_V1_Controller {
|
|||
// Fetch the new object from the database and return it to the client.
|
||||
$batch = $this->appointments_model->get_batch('id = ' . $id);
|
||||
$response = new Response($batch);
|
||||
$status = new NonEmptyAlphanumeric('201 Created');
|
||||
$status = new NonEmptyText('201 Created');
|
||||
$response->encode($this->parser)->singleEntry(true)->output($status);
|
||||
} catch(\Exception $exception) {
|
||||
exit($this->_handleException($exception));
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* API v1 Authorization Class
|
||||
|
@ -40,12 +40,12 @@ class Authorization {
|
|||
/**
|
||||
* Perform Basic Authentication
|
||||
*
|
||||
* @param NonEmptyAlphanumeric $username Admin Username
|
||||
* @param NonEmptyAlphanumeric $password Admin Password
|
||||
* @param NonEmptyText $username Admin Username
|
||||
* @param NonEmptyText $password Admin Password
|
||||
*
|
||||
* @throws \EA\Engine\Api\V1\Exception Throws 401-Unauthorized exception if the authentication fails.
|
||||
*/
|
||||
public function basic(NonEmptyAlphanumeric $username, NonEmptyAlphanumeric $password) {
|
||||
public function basic(NonEmptyText $username, NonEmptyText $password) {
|
||||
$this->framework->load->model('user_model');
|
||||
|
||||
if (!$this->framework->user_model->check_login($username->get(), $password->get())) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use EA\Engine\Types\NonEmptyText;
|
||||
|
||||
/**
|
||||
* API v1 Response
|
||||
|
@ -124,12 +124,12 @@ class Response {
|
|||
/**
|
||||
* Output the response as a JSON with the provided status header.
|
||||
*
|
||||
* @param \EA\Engine\Types\NonEmptyAlphanumeric $status Optional (null), if provided it must contain the status
|
||||
* @param \EA\Engine\Types\NonEmptyText $status Optional (null), if provided it must contain the status
|
||||
* header value. Default string: '200 OK'.
|
||||
*
|
||||
* @return \EA\Engine\Api\V1\Response
|
||||
*/
|
||||
public function output(NonEmptyAlphanumeric $status = null) {
|
||||
public function output(NonEmptyText $status = null) {
|
||||
$header = $status ? $status->get() : '200 OK';
|
||||
|
||||
header('HTTP/1.0 ' . $header);
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
namespace EA\Engine\Notifications;
|
||||
|
||||
use \EA\Engine\Types\Alphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\Text;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
use \EA\Engine\Types\Url;
|
||||
use \EA\Engine\Types\Email as EmailAddress;
|
||||
|
||||
|
@ -82,14 +82,14 @@ class Email {
|
|||
* @param array $customer Contains the customer data.
|
||||
* @param array $company Contains settings of the company. By the time the
|
||||
* "company_name", "company_link" and "company_email" values are required in the array.
|
||||
* @param \EA\Engine\Types\Alphanumeric $title The email title may vary depending the receiver.
|
||||
* @param \EA\Engine\Types\Alphanumeric $message The email message may vary depending the receiver.
|
||||
* @param \EA\Engine\Types\Text $title The email title may vary depending the receiver.
|
||||
* @param \EA\Engine\Types\Text $message The email message may vary depending the receiver.
|
||||
* @param \EA\Engine\Types\Url $appointmentLink This link is going to enable the receiver to make changes
|
||||
* to the appointment record.
|
||||
* @param \EA\Engine\Types\Email $recipientEmail The recipient email address.
|
||||
*/
|
||||
public function sendAppointmentDetails(array $appointment, array $provider, array $service,
|
||||
array $customer, array $company, Alphanumeric $title, Alphanumeric $message, Url $appointmentLink,
|
||||
array $customer, array $company, Text $title, Text $message, Url $appointmentLink,
|
||||
EmailAddress $recipientEmail) {
|
||||
|
||||
// Prepare template replace array.
|
||||
|
@ -159,7 +159,7 @@ class Email {
|
|||
*/
|
||||
public function sendDeleteAppointment(array $appointment, array $provider,
|
||||
array $service, array $customer, array $company, EmailAddress $recipientEmail,
|
||||
Alphanumeric $reason) {
|
||||
Text $reason) {
|
||||
// Prepare email template data.
|
||||
$replaceArray = array(
|
||||
'$email_title' => $this->framework->lang->line('appointment_cancelled_title'),
|
||||
|
@ -211,11 +211,11 @@ class Email {
|
|||
/**
|
||||
* This method sends an email with the new password of a user.
|
||||
*
|
||||
* @param \EA\Engine\Types\NonEmptyAlphanumeric $password Contains the new password.
|
||||
* @param \EA\Engine\Types\NonEmptyText $password Contains the new password.
|
||||
* @param \EA\Engine\Types\Email $recipientEmail The receiver's email address.
|
||||
* @param array $company The company settings to be included in the email.
|
||||
*/
|
||||
public function sendPassword(NonEmptyAlphanumeric $password, EmailAddress $recipientEmail, array $company) {
|
||||
public function sendPassword(NonEmptyText $password, EmailAddress $recipientEmail, array $company) {
|
||||
$replaceArray = array(
|
||||
'$email_title' => $this->framework->lang->line('new_account_password'),
|
||||
'$email_message' => $this->framework->lang->line('new_password_is'),
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
class Email extends NonEmptyAlphanumeric {
|
||||
class Email extends NonEmptyText {
|
||||
protected function _validate($value) {
|
||||
return parent::_validate($value) && filter_var($value, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
class NonEmptyAlphanumeric extends Alphanumeric {
|
||||
class NonEmptyText extends Text {
|
||||
protected function _validate($value) {
|
||||
return parent::_validate($value) && $value !== '';
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
class Alphanumeric extends Type {
|
||||
class Text extends Type {
|
||||
protected function _validate($value) {
|
||||
return is_string($value);
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
class Url extends NonEmptyAlphanumeric {
|
||||
class Url extends NonEmptyText {
|
||||
protected function _validate($value) {
|
||||
return parent::_validate($value) && filter_var($value, FILTER_VALIDATE_URL);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace EA\Engine\Api\V1;
|
||||
|
||||
use \EA\Engine\Types\NonEmptyAlphanumeric;
|
||||
use \EA\Engine\Types\NonEmptyText;
|
||||
|
||||
class AuthorizationTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testBasicMethodPerformsBasicAuthentication() {
|
||||
|
|
|
@ -15,17 +15,17 @@ namespace EA\Engine\Types;
|
|||
|
||||
class NonEmptyAlphanumericTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testNonEmptyStringType() {
|
||||
$type = new NonEmptyAlphanumeric('Hello!');
|
||||
$type = new NonEmptyText('Hello!');
|
||||
$this->assertEquals('Hello!', $type->get());
|
||||
}
|
||||
|
||||
public function testNonEmptyStringTypeThrowsExceptionWithEmptyString() {
|
||||
$this->setExpectedException('\InvalidArgumentException');
|
||||
new NonEmptyAlphanumeric('');
|
||||
new NonEmptyText('');
|
||||
}
|
||||
|
||||
public function testNonEmptyStringTypeThrowsExceptionWithInvalidValue() {
|
||||
$this->setExpectedException('\InvalidArgumentException');
|
||||
new NonEmptyAlphanumeric(null);
|
||||
new NonEmptyText(null);
|
||||
}
|
||||
}
|
|
@ -13,14 +13,14 @@
|
|||
|
||||
namespace EA\Engine\Types;
|
||||
|
||||
class AlphanumericTest extends \PHPUnit_Framework_TestCase {
|
||||
class TextTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testStringType() {
|
||||
$type = new Alphanumeric('Hello!');
|
||||
$type = new Text('Hello!');
|
||||
$this->assertEquals('Hello!', $type->get());
|
||||
}
|
||||
|
||||
public function testStringTypeThrowsExceptionWithInvalidValue() {
|
||||
$this->setExpectedException('\InvalidArgumentException');
|
||||
new Alphanumeric(null);
|
||||
new Text(null);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue