Skip to content
Permalink
Browse files

Fix translation shortcut usage through testing console for updates

  • Loading branch information...
predominant committed Apr 15, 2010
1 parent c98021d commit 74d7682707a6864cd8419e2f138d3cccbe905ba3
@@ -324,17 +324,11 @@ public function testClearCache() {
public function test__() {
Configure::write('Config.language', 'rule_1_po');
$result = __('Plural Rule 1', true);
$result = __('Plural Rule 1');
$expected = 'Plural Rule 1 (translated)';
$this->assertEqual($result, $expected);
$result = __('Plural Rule 1 (from core)', true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
__('Plural Rule 1 (from core)');
$result = ob_get_clean();
$result = __('Plural Rule 1 (from core)');
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
}
@@ -347,21 +341,15 @@ public function test__() {
public function test__n() {
Configure::write('Config.language', 'rule_1_po');
$result = __n('%d = 1', '%d = 0 or > 1', 0, true);
$result = __n('%d = 1', '%d = 0 or > 1', 0);
$expected = '%d = 0 or > 1 (translated)';
$this->assertEqual($result, $expected);
$result = __n('%d = 1', '%d = 0 or > 1', 1, true);
$result = __n('%d = 1', '%d = 0 or > 1', 1);
$expected = '%d = 1 (translated)';
$this->assertEqual($result, $expected);
$result = __n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', 2, true);
$expected = '%d = 0 or > 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', 2);
$result = ob_get_clean();
$result = __n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', 2);
$expected = '%d = 0 or > 1 (from core translated)';
$this->assertEqual($result, $expected);
}
@@ -374,21 +362,15 @@ public function test__n() {
public function test__d() {
Configure::write('Config.language', 'rule_1_po');
$result = __d('default', 'Plural Rule 1', true);
$result = __d('default', 'Plural Rule 1');
$expected = 'Plural Rule 1 (translated)';
$this->assertEqual($result, $expected);
$result = __d('core', 'Plural Rule 1', true);
$result = __d('core', 'Plural Rule 1');
$expected = 'Plural Rule 1';
$this->assertEqual($result, $expected);
$result = __d('core', 'Plural Rule 1 (from core)', true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
__d('core', 'Plural Rule 1 (from core)');
$result = ob_get_clean();
$result = __d('core', 'Plural Rule 1 (from core)');
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
}
@@ -401,27 +383,22 @@ public function test__d() {
public function test__dn() {
Configure::write('Config.language', 'rule_1_po');
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 0, true);
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 0);
$expected = '%d = 0 or > 1 (translated)';
$this->assertEqual($result, $expected);
$result = __dn('core', '%d = 1', '%d = 0 or > 1', 0, true);
$result = __dn('core', '%d = 1', '%d = 0 or > 1', 0);
$expected = '%d = 0 or > 1';
$this->assertEqual($result, $expected);
$result = __dn('core', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 0, true);
$result = __dn('core', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 0);
$expected = '%d = 0 or > 1 (from core translated)';
$this->assertEqual($result, $expected);
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 1, true);
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 1);
$expected = '%d = 1 (translated)';
$this->assertEqual($result, $expected);
ob_start();
__dn('core', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 2);
$result = ob_get_clean();
$expected = '%d = 0 or > 1 (from core translated)';
$this->assertEqual($result, $expected);
}
/**
@@ -432,17 +409,11 @@ public function test__dn() {
public function test__c() {
Configure::write('Config.language', 'rule_1_po');
$result = __c('Plural Rule 1', 6, true);
$result = __c('Plural Rule 1', 6);
$expected = 'Plural Rule 1 (translated)';
$this->assertEqual($result, $expected);
$result = __c('Plural Rule 1 (from core)', 6, true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
__c('Plural Rule 1 (from core)', 6);
$result = ob_get_clean();
$result = __c('Plural Rule 1 (from core)', 6);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
}
@@ -455,25 +426,19 @@ public function test__c() {
public function test__dc() {
Configure::write('Config.language', 'rule_1_po');
$result = __dc('default', 'Plural Rule 1', 6, true);
$result = __dc('default', 'Plural Rule 1', 6);
$expected = 'Plural Rule 1 (translated)';
$this->assertEqual($result, $expected);
$result = __dc('default', 'Plural Rule 1 (from core)', 6, true);
$result = __dc('default', 'Plural Rule 1 (from core)', 6);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
$result = __dc('core', 'Plural Rule 1', 6, true);
$result = __dc('core', 'Plural Rule 1', 6);
$expected = 'Plural Rule 1';
$this->assertEqual($result, $expected);
$result = __dc('core', 'Plural Rule 1 (from core)', 6, true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
__dc('default', 'Plural Rule 1 (from core)', 6);
$result = ob_get_clean();
$result = __dc('core', 'Plural Rule 1 (from core)', 6);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
}
@@ -486,23 +451,17 @@ public function test__dc() {
public function test__dcn() {
Configure::write('Config.language', 'rule_1_po');
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6, true);
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6);
$expected = '%d = 0 or > 1 (translated)';
$this->assertEqual($result, $expected);
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6, true);
$result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6);
$expected = '%d = 1 (from core translated)';
$this->assertEqual($result, $expected);
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 6, true);
$result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 6);
$expected = '%d = 0 or > 1';
$this->assertEqual($result, $expected);
ob_start();
__dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6);
$result = ob_get_clean();
$expected = '%d = 1 (from core translated)';
$this->assertEqual($result, $expected);
}
/**
@@ -310,20 +310,20 @@ public function testBakeActionsUsingSessions() {
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('Invalid %s', true), 'article'));") !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('Invalid %s'), 'article'));") !== false);
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
$this->assertTrue(strpos($result, 'function add()') !== false);
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s has been saved', true), 'article'));") !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s has been saved'), 'article'));") !== false);
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'article'));") !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.'), 'article'));") !== false);
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('%s deleted', true), 'Article'));") !== false);
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('%s deleted'), 'Article'));") !== false);
$result = $this->Task->bakeActions('Articles', 'admin_', true);
@@ -352,21 +352,21 @@ public function testBakeActionsWithNoSessions() {
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('Invalid %s', true), 'article'), array('action' => 'index'))") !== false);
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('Invalid %s'), 'article'), array('action' => 'index'))") !== false);
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
$this->assertTrue(strpos($result, 'function add()') !== false);
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('The %s has been saved.', true), 'article'), array('action' => 'index'))") !== false);
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('The %s has been saved.'), 'article'), array('action' => 'index'))") !== false);
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
$this->assertTrue(strpos($result, "\$this->set(compact('tags'))") !== false);
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('%s deleted', true), 'Article'), array('action' => 'index'))") !== false);
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('%s deleted'), 'Article'), array('action' => 'index'))") !== false);
}
/**
@@ -149,7 +149,7 @@ function testSocketReading() {
$this->Socket = new CakeSocket($config);
$this->assertTrue($this->Socket->connect());
$this->assertFalse($this->Socket->read(1024 * 1024));
$this->assertEqual($this->Socket->lastError(), '2: ' . __('Connection timed out', true));
$this->assertEqual($this->Socket->lastError(), '2: ' . __('Connection timed out'));
$config = array('host' => 'www.cakephp.org', 'timeout' => 30);
$this->Socket = new CakeSocket($config);
@@ -461,7 +461,7 @@ function _getTmpFile($paintSkip = true) {
$shortPath = substr($tmpFile, strlen(ROOT));
$message = '[FileTest] Skipping %s because "%s" not writeable!';
$message = sprintf(__($message, true), $caller, $shortPath).$assertLine;
$message = sprintf(__($message), $caller, $shortPath).$assertLine;
$this->_reporter->paintSkip($message);
}
return false;
Oops, something went wrong.

0 comments on commit 74d7682

Please sign in to comment.
You can’t perform that action at this time.