Exemplo n.º 1
0
 public function testConvertToTitleCase()
 {
     $this->assertEquals('From Camel Case', NameUtilities::convertToTitleCase('fromCamelCase'));
     $this->assertEquals('From Studly Caps', NameUtilities::convertToTitleCase('FromStudlyCaps'));
     $this->assertEquals('From Dashed Lower', NameUtilities::convertToTitleCase('from-dashed-lower'));
     $this->assertEquals('From Underscore Lower', NameUtilities::convertToTitleCase('from_underscore_lower'));
     $this->assertEquals('From Underscore Caps', NameUtilities::convertToTitleCase('From_Underscore_Caps'));
     $this->assertEquals('From Lower Case', NameUtilities::convertToTitleCase('from lower case'));
     $this->assertEquals('From Title Case', NameUtilities::convertToTitleCase('From Title Case'));
     $this->assertEquals('This One Isnt Easy A Test Case Sitegear Org', NameUtilities::convertToTitleCase('This One Isn\'t Easy - A Test Case @ sitegear.org'));
 }
Exemplo n.º 2
0
 /**
  * Send a simple plain-text notification email with the given data.  This is useful for contact form submissions as
  * the notification sent to the site owner.
  *
  * @param string $subject
  * @param array[] $addresses
  * @param array $data
  * @param string $intro Text to display above the data list
  * @param string $outro Text to display below the data list
  * @param string|null $charset
  *
  * @return boolean
  */
 public function sendTextNotification($subject, $addresses, $data, $intro = null, $outro = null, $charset = null)
 {
     LoggerRegistry::debug('SwiftMailerModule::sendTextNotification({subject}, {addresses}, {data}, intro[{introCount} characters], outro[{outroCount} characters], {charset})', array('subject' => TypeUtilities::describe($subject), 'addresses' => TypeUtilities::describe($addresses), 'data' => TypeUtilities::describe($data), 'introCount' => strlen($intro), 'outroCount' => strlen($outro), 'charset' => TypeUtilities::describe($charset)));
     $nl = "\r\n";
     $body = sprintf('** %s **', $subject) . $nl . $nl;
     $body .= ($intro ?: 'The following data was submitted:') . $nl . $nl;
     foreach ($data as $key => $value) {
         $body .= sprintf(' * %s: %s', NameUtilities::convertToTitleCase($key), $value) . $nl;
     }
     $body .= $nl . ($outro ?: 'This message text was automatically generated.') . $nl . $nl;
     return $this->send($subject, $addresses, $body, 'text/plain', $charset);
 }