Fixing unit tests.

This commit is contained in:
mattmemmesheimer 2015-08-18 22:14:10 -05:00
parent d3cf879195
commit d4467f9acf
2 changed files with 9 additions and 9 deletions

View file

@ -222,7 +222,7 @@ class ControllerTaskTest extends CakeTestCase {
public function testDoComponentsNo() { public function testDoComponentsNo() {
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n')); $this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
$result = $this->Task->doComponents(); $result = $this->Task->doComponents();
$this->assertSame(array('Paginator'), $result); $this->assertSame(array('Paginator', 'Flash'), $result);
} }
/** /**
@ -235,7 +235,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security ')); $this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security '));
$result = $this->Task->doComponents(); $result = $this->Task->doComponents();
$expected = array('Paginator', 'RequestHandler', 'Security'); $expected = array('Paginator', 'Flash', 'RequestHandler', 'Security');
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }
@ -249,7 +249,7 @@ class ControllerTaskTest extends CakeTestCase {
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security, , ')); $this->Task->expects($this->at(1))->method('in')->will($this->returnValue(' RequestHandler, Security, , '));
$result = $this->Task->doComponents(); $result = $this->Task->doComponents();
$expected = array('Paginator', 'RequestHandler', 'Security'); $expected = array('Paginator', 'Flash', 'RequestHandler', 'Security');
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }

View file

@ -33,10 +33,10 @@
if ($this->request->is('post')) { if ($this->request->is('post')) {
$this->BakeArticle->create(); $this->BakeArticle->create();
if ($this->BakeArticle->save($this->request->data)) { if ($this->BakeArticle->save($this->request->data)) {
$this->Session->setFlash(__('The bake article has been saved.')); $this->Flash->success(__('The bake article has been saved.'));
return $this->redirect(array('action' => 'index')); return $this->redirect(array('action' => 'index'));
} else { } else {
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.')); $this->Flash->error(__('The bake article could not be saved. Please, try again.'));
} }
} }
$bakeTags = $this->BakeArticle->BakeTag->find('list'); $bakeTags = $this->BakeArticle->BakeTag->find('list');
@ -56,10 +56,10 @@
} }
if ($this->request->is(array('post', 'put'))) { if ($this->request->is(array('post', 'put'))) {
if ($this->BakeArticle->save($this->request->data)) { if ($this->BakeArticle->save($this->request->data)) {
$this->Session->setFlash(__('The bake article has been saved.')); $this->Flash->success(__('The bake article has been saved.'));
return $this->redirect(array('action' => 'index')); return $this->redirect(array('action' => 'index'));
} else { } else {
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.')); $this->Flash->error(__('The bake article could not be saved. Please, try again.'));
} }
} else { } else {
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id)); $options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
@ -83,9 +83,9 @@
} }
$this->request->allowMethod('post', 'delete'); $this->request->allowMethod('post', 'delete');
if ($this->BakeArticle->delete()) { if ($this->BakeArticle->delete()) {
$this->Session->setFlash(__('The bake article has been deleted.')); $this->Flash->success(__('The bake article has been deleted.'));
} else { } else {
$this->Session->setFlash(__('The bake article could not be deleted. Please, try again.')); $this->Flash->error(__('The bake article could not be deleted. Please, try again.'));
} }
return $this->redirect(array('action' => 'index')); return $this->redirect(array('action' => 'index'));
} }