diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 570649170..c9f5712cc 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -432,6 +432,7 @@ class ExtractTask extends AppShell { $category = isset($category) ? $category : 6; $category = (int)$category; $categoryName = $categories[$category]; + $domain = isset($domain) ? $domain : 'default'; $details = array( 'file' => $this->_file, @@ -443,7 +444,10 @@ class ExtractTask extends AppShell { if (isset($context)) { $details['msgctxt'] = $context; } - $this->_addTranslation($categoryName, $domain, $singular, $details); + // Skip LC_TIME files as we use a special file format for them. + if ($categoryName !== 'LC_TIME') { + $this->_addTranslation($categoryName, $domain, $singular, $details); + } } else { $this->_markerError($this->_file, $line, $functionName, $count); } diff --git a/lib/Cake/Console/Templates/default/views/index.ctp b/lib/Cake/Console/Templates/default/views/index.ctp index d3d4caaf3..cf77c0ed9 100644 --- a/lib/Cake/Console/Templates/default/views/index.ctp +++ b/lib/Cake/Console/Templates/default/views/index.ctp @@ -48,7 +48,7 @@ echo "\t\t
Paginator->counter(array( - 'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') + 'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') )); ?>"; ?>
diff --git a/lib/Cake/Controller/Component/PaginatorComponent.php b/lib/Cake/Controller/Component/PaginatorComponent.php index 94a606552..e0203acef 100644 --- a/lib/Cake/Controller/Component/PaginatorComponent.php +++ b/lib/Cake/Controller/Component/PaginatorComponent.php @@ -388,6 +388,10 @@ class PaginatorComponent extends Component { if (!empty($options['order']) && is_array($options['order'])) { $order = array(); foreach ($options['order'] as $key => $value) { + if (is_int($key)) { + $key = $value; + $value = 'asc'; + } $field = $key; $alias = $object->alias; if (strpos($key, '.') !== false) { diff --git a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php index 238803acf..363afb2ff 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php @@ -162,19 +162,19 @@ class ExtractTaskTest extends CakeTestCase { $this->assertContains('msgid "double \\"quoted\\""', $result, 'Strings with quotes not handled correctly'); $this->assertContains("msgid \"single 'quoted'\"", $result, 'Strings with quotes not handled correctly'); - $pattern = '/\#: (\\\\|\/)extract\.ctp:34\nmsgid "letter"/'; + $pattern = '/\#: (\\\\|\/)extract\.ctp:36\nmsgid "letter"/'; $this->assertRegExp($pattern, $result, 'Strings with context should not overwrite strings without context'); - $pattern = '/\#: (\\\\|\/)extract\.ctp:35;37\nmsgctxt "A"\nmsgid "letter"/'; + $pattern = '/\#: (\\\\|\/)extract\.ctp:37;39\nmsgctxt "A"\nmsgid "letter"/'; $this->assertRegExp($pattern, $result, 'Should contain string with context "A"'); - $pattern = '/\#: (\\\\|\/)extract\.ctp:36\nmsgctxt "B"\nmsgid "letter"/'; + $pattern = '/\#: (\\\\|\/)extract\.ctp:38\nmsgctxt "B"\nmsgid "letter"/'; $this->assertRegExp($pattern, $result, 'Should contain string with context "B"'); - $pattern = '/\#: (\\\\|\/)extract\.ctp:38\nmsgid "%d letter"\nmsgid_plural "%d letters"/'; + $pattern = '/\#: (\\\\|\/)extract\.ctp:40\nmsgid "%d letter"\nmsgid_plural "%d letters"/'; $this->assertRegExp($pattern, $result, 'Plural strings with context should not overwrite strings without context'); - $pattern = '/\#: (\\\\|\/)extract\.ctp:39\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/'; + $pattern = '/\#: (\\\\|\/)extract\.ctp:41\nmsgctxt "A"\nmsgid "%d letter"\nmsgid_plural "%d letters"/'; $this->assertRegExp($pattern, $result, 'Should contain plural string with context "A"'); // extract.ctp - reading the domain.pot @@ -209,12 +209,16 @@ class ExtractTaskTest extends CakeTestCase { $this->Task->expects($this->never())->method('_stop'); $this->Task->execute(); - $this->assertTrue(file_exists($this->path . DS . 'LC_TIME' . DS . 'default.pot')); + $this->assertTrue(file_exists($this->path . DS . 'LC_NUMERIC' . DS . 'default.pot')); + $this->assertFalse(file_exists($this->path . DS . 'LC_TIME' . DS . 'default.pot')); $result = file_get_contents($this->path . DS . 'default.pot'); $pattern = '/\#: .*extract\.ctp:31\n/'; $this->assertNotRegExp($pattern, $result); + + $pattern = '/\#: .*extract\.ctp:33\n/'; + $this->assertNotRegExp($pattern, $result); } /** diff --git a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php index 6b02d12ba..c5ab4762f 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ViewTaskTest.php @@ -323,10 +323,11 @@ class ViewTaskTest extends CakeTestCase { public function testBakeIndex() { $this->Task->controllerName = 'ViewTaskComments'; + $expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'View' . DS . 'index.ctp'); $this->Task->expects($this->at(0))->method('createFile') ->with( TMP . 'ViewTaskComments' . DS . 'index.ctp', - $this->stringContains("\$viewTaskComment['Article']['title']") + $expected ); $this->Task->bake('index', true); } diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index 5fa098314..4ce1ffe99 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -454,6 +454,13 @@ class PaginatorComponentTest extends CakeTestCase { $this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id')); $this->assertTrue(!isset($Controller->PaginatorControllerPost->lastQueries[1]['contain'])); + $Controller->Paginator->settings = array( + 'order' => array('PaginatorControllerPost.author_id') + ); + $result = $Controller->Paginator->paginate('PaginatorControllerPost'); + $this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']); + $this->assertEquals(array(1, 3, 2), Hash::extract($result, '{n}.PaginatorControllerPost.id')); + $Controller->request->params['named'] = array('page' => '-1'); $Controller->Paginator->settings = array( 'PaginatorControllerPost' => array( @@ -606,7 +613,7 @@ class PaginatorComponentTest extends CakeTestCase { $Controller->PaginatorControllerPost->order = array('PaginatorControllerPost.id'); $result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array()); - $this->assertEmpty($result['order']); + $this->assertEquals(array('PaginatorControllerPost.id' => 'asc'), $result['order']); $Controller->PaginatorControllerPost->order = 'PaginatorControllerPost.id'; $result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array()); @@ -617,7 +624,10 @@ class PaginatorComponentTest extends CakeTestCase { 'PaginatorControllerPost.created' => 'asc' ); $result = $Controller->Paginator->validateSort($Controller->PaginatorControllerPost, array()); - $expected = array('PaginatorControllerPost.created' => 'asc'); + $expected = array( + 'PaginatorControllerPost.id' => 'asc', + 'PaginatorControllerPost.created' => 'asc' + ); $this->assertEquals($expected, $result['order']); } diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php index 9d06f1886..f38dc402a 100644 --- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php @@ -117,6 +117,10 @@ class TextHelperTest extends CakeTestCase { * @return void */ public function testAutoLink() { + $text = 'The AWWWARD show happened today'; + $result = $this->Text->autoLink($text); + $this->assertEquals($text, $result); + $text = 'This is a test text'; $expected = 'This is a test text'; $result = $this->Text->autoLink($text); @@ -127,6 +131,10 @@ class TextHelperTest extends CakeTestCase { $expected = 'Text with a partial www.cakephp.org URL and test@cakephp\.org email address'; $this->assertRegExp('#^' . $expected . '$#', $result); + $text = 'Text with a partial link link'; + $result = $this->Text->autoLink($text, array('escape' => false)); + $this->assertEquals($text, $result); + $text = 'This is a test text with URL http://www.cakephp.org'; $expected = 'This is a test text with URL http://www.cakephp.org'; $result = $this->Text->autoLink($text); diff --git a/lib/Cake/Test/bake_compare/View/index.ctp b/lib/Cake/Test/bake_compare/View/index.ctp new file mode 100644 index 000000000..b2738e4b3 --- /dev/null +++ b/lib/Cake/Test/bake_compare/View/index.ctp @@ -0,0 +1,58 @@ +Paginator->sort('id'); ?> | +Paginator->sort('article_id'); ?> | +Paginator->sort('user_id'); ?> | +Paginator->sort('comment'); ?> | +Paginator->sort('published'); ?> | +Paginator->sort('created'); ?> | +Paginator->sort('updated'); ?> | ++ |
---|---|---|---|---|---|---|---|
+ | + Html->link($viewTaskComment['Article']['title'], array('controller' => 'view_task_articles', 'action' => 'view', $viewTaskComment['Article']['id'])); ?> + | ++ | + | + | + | + | + Html->link(__('View'), array('action' => 'view', $viewTaskComment['ViewTaskComment']['id'])); ?> + Html->link(__('Edit'), array('action' => 'edit', $viewTaskComment['ViewTaskComment']['id'])); ?> + Form->postLink(__('Delete'), array('action' => 'delete', $viewTaskComment['ViewTaskComment']['id']), array('confirm' => __('Are you sure you want to delete # %s?', $viewTaskComment['ViewTaskComment']['id']))); ?> + | +
+ Paginator->counter(array( + 'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}') + )); + ?>
+