mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.6
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
3095187952
4 changed files with 38 additions and 16 deletions
|
@ -89,7 +89,7 @@ class SchemaShell extends AppShell {
|
||||||
$name = $plugin;
|
$name = $plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$name = Inflector::classify($name);
|
$name = Inflector::camelize($name);
|
||||||
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
|
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,10 +292,10 @@ class SchemaShell extends AppShell {
|
||||||
$Schema = $this->Schema->load($options);
|
$Schema = $this->Schema->load($options);
|
||||||
|
|
||||||
if (!$Schema) {
|
if (!$Schema) {
|
||||||
$this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:'));
|
$this->err(__d('cake_console', '<error>Error</error>: The chosen schema could not be loaded. Attempted to load:'));
|
||||||
$this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file));
|
$this->err(__d('cake_console', '- file: %s', $this->Schema->path . DS . $this->Schema->file));
|
||||||
$this->err(__d('cake_console', 'Name: %s', $this->Schema->name));
|
$this->err(__d('cake_console', '- name: %s', $this->Schema->name));
|
||||||
return $this->_stop();
|
return $this->_stop(2);
|
||||||
}
|
}
|
||||||
$table = null;
|
$table = null;
|
||||||
if (isset($this->args[1])) {
|
if (isset($this->args[1])) {
|
||||||
|
|
|
@ -553,7 +553,9 @@ class CakeEmail {
|
||||||
/**
|
/**
|
||||||
* EmailPattern setter/getter
|
* EmailPattern setter/getter
|
||||||
*
|
*
|
||||||
* @param string $regex for email address validation
|
* @param string|bool|null $regex The pattern to use for email address validation,
|
||||||
|
* null to unset the pattern and make use of filter_var() instead, false or
|
||||||
|
* nothing to return the current value
|
||||||
* @return string|$this
|
* @return string|$this
|
||||||
*/
|
*/
|
||||||
public function emailPattern($regex = false) {
|
public function emailPattern($regex = false) {
|
||||||
|
@ -602,10 +604,11 @@ class CakeEmail {
|
||||||
* @throws SocketException If email address does not validate
|
* @throws SocketException If email address does not validate
|
||||||
*/
|
*/
|
||||||
protected function _validateEmail($email) {
|
protected function _validateEmail($email) {
|
||||||
if ($this->_emailPattern === null && filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if ($this->_emailPattern === null) {
|
||||||
return;
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
}
|
return;
|
||||||
if (preg_match($this->_emailPattern, $email)) {
|
}
|
||||||
|
} elseif (preg_match($this->_emailPattern, $email)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new SocketException(__d('cake_dev', 'Invalid email: "%s"', $email));
|
throw new SocketException(__d('cake_dev', 'Invalid email: "%s"', $email));
|
||||||
|
|
|
@ -617,19 +617,19 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$this->Shell->params = array(
|
$this->Shell->params = array(
|
||||||
'plugin' => 'TestPlugin',
|
'plugin' => 'TestPlugin',
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
'name' => 'custom_name',
|
'name' => 'custom_names',
|
||||||
'force' => false,
|
'force' => false,
|
||||||
'overwrite' => true,
|
'overwrite' => true,
|
||||||
);
|
);
|
||||||
$this->Shell->startup();
|
$this->Shell->startup();
|
||||||
if (file_exists($this->Shell->Schema->path . DS . 'custom_name.php')) {
|
if (file_exists($this->Shell->Schema->path . DS . 'custom_names.php')) {
|
||||||
unlink($this->Shell->Schema->path . DS . 'custom_name.php');
|
unlink($this->Shell->Schema->path . DS . 'custom_names.php');
|
||||||
}
|
}
|
||||||
$this->Shell->generate();
|
$this->Shell->generate();
|
||||||
|
|
||||||
$contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_name.php');
|
$contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_names.php');
|
||||||
$this->assertRegExp('/class CustomNameSchema/', $contents);
|
$this->assertRegExp('/class CustomNamesSchema/', $contents);
|
||||||
unlink($this->Shell->Schema->path . DS . 'custom_name.php');
|
unlink($this->Shell->Schema->path . DS . 'custom_names.php');
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -386,6 +386,25 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
), $this->CakeEmail->to());
|
), $this->CakeEmail->to());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that it is possible to unset the email pattern and make use of filter_var() instead.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @expectedException SocketException
|
||||||
|
* @expectedExceptionMessage Invalid email: "fail.@example.com"
|
||||||
|
*/
|
||||||
|
public function testUnsetEmailPattern() {
|
||||||
|
$email = new CakeEmail();
|
||||||
|
$this->assertSame(CakeEmail::EMAIL_PATTERN, $email->emailPattern());
|
||||||
|
|
||||||
|
$email->emailPattern(null);
|
||||||
|
$this->assertNull($email->emailPattern());
|
||||||
|
|
||||||
|
$email->to('pass@example.com');
|
||||||
|
$email->to('fail.@example.com');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFormatAddress method
|
* testFormatAddress method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue