Skip to content

Commit b1a3e05

Browse files
committed
Fixing failing tests in ControllerTask.
1 parent 1c7c748 commit b1a3e05

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

cake/tests/cases/console/libs/tasks/controller.test.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,21 +318,22 @@ function testBakeActionsUsingSessions() {
318318
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
319319

320320
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
321-
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Invalid article', true))") !== false);
321+
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('Invalid %s', true), 'article'));") !== false);
322322
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
323323

324324
$this->assertTrue(strpos($result, 'function add()') !== false);
325325
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
326326
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
327-
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article has been saved', true))") !== false);
327+
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s has been saved', true), 'article'));") !== false);
328328

329329
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
330-
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article could not be saved. Please, try again.', true));") !== false);
330+
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'article'));") !== false);
331331

332332
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
333333
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
334-
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Article deleted', true))") !== false);
334+
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('%s deleted', true), 'Article'));") !== false);
335335

336+
debug($result, true);
336337

337338
$result = $this->Task->bakeActions('Articles', 'admin_', true);
338339

@@ -362,21 +363,21 @@ function testBakeActionsWithNoSessions() {
362363
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
363364

364365
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
365-
$this->assertTrue(strpos($result, "\$this->flash(__('Invalid article', true), array('action' => 'index'))") !== false);
366+
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('Invalid %s', true), 'article'), array('action' => 'index'))") !== false);
366367
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
367368

368369
$this->assertTrue(strpos($result, 'function add()') !== false);
369370
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
370371
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
371-
$this->assertTrue(strpos($result, "\$this->flash(__('The article has been saved.', true), array('action' => 'index'))") !== false);
372+
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('The %s has been saved.', true), 'article'), array('action' => 'index'))") !== false);
372373

373374
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
374375
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
375376
$this->assertTrue(strpos($result, "\$this->set(compact('tags'))") !== false);
376377

377378
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
378379
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
379-
$this->assertTrue(strpos($result, "\$this->flash(__('Article deleted', true), array('action' => 'index'))") !== false);
380+
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('%s deleted', true), 'Article'), array('action' => 'index'))") !== false);
380381
}
381382

382383
/**

0 commit comments

Comments
 (0)