Adding test for Validate::ip().

Fixed Ticket #2298.
Fixed issue with I10n class not setting default language

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4689 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-03-27 02:59:22 +00:00
parent 51250a4e5d
commit 9ace567e8e
3 changed files with 7 additions and 2 deletions

View file

@ -235,6 +235,10 @@ class EmailComponent extends Object{
$this->delivery = 'debug';
}
$__method = '__'.$this->delivery;
if(low($this->charset) === 'utf-8') {
$this->subject = utf8_decode($this->subject);
}
return $this->$__method();
}
/**

View file

@ -374,7 +374,7 @@ class L10n extends Object {
}
if($this->default) {
$this->languagePath = array(2 => $this->__l10nCatalog[$this->default]['localeFallback']);
$this->languagePath[2] = $this->__l10nCatalog[$this->default]['localeFallback'];
}
$this->found = true;
Configure::write('Config.language', $this->lang);
@ -398,7 +398,7 @@ class L10n extends Object {
$this->charset = $this->__l10nCatalog[$langKey]['charset'];
if($this->default) {
$this->languagePath = array(2 => $this->__l10nCatalog[$this->default]['localeFallback']);
$this->languagePath[2] = $this->__l10nCatalog[$this->default]['localeFallback'];
}
$this->found = true;
Configure::write('Config.language', $this->lang);

View file

@ -1216,6 +1216,7 @@ class ValidationTestCase extends UnitTestCase {
function testIp() {
$validation = new Validation();
$this->assertTrue($validation->ip('0.0.0.0'));
$this->assertTrue($validation->ip('192.168.1.156'));
$this->assertTrue($validation->ip('255.255.255.255'));
$this->assertFalse($validation->ip('127.0.0'));
$this->assertFalse($validation->ip('127.0.0.a'));