mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix tests
This commit is contained in:
parent
c59fb85da8
commit
924d382bb3
2 changed files with 74 additions and 27 deletions
|
@ -68,6 +68,27 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
|
|
||||||
|
$this->Flash->set('This is the first message');
|
||||||
|
$this->Flash->set('This is the second message');
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'message' => 'This is the first message',
|
||||||
|
'key' => 'flash',
|
||||||
|
'element' => 'Flash/default',
|
||||||
|
'params' => array()
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'message' => 'This is the second message',
|
||||||
|
'key' => 'flash',
|
||||||
|
'element' => 'Flash/default',
|
||||||
|
'params' => array()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result = CakeSession::read('Message.flash');
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
|
|
||||||
$this->Flash->set('This is a test message', array(
|
$this->Flash->set('This is a test message', array(
|
||||||
'element' => 'test',
|
'element' => 'test',
|
||||||
|
@ -83,6 +104,7 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
|
|
||||||
$this->Flash->set('This is a test message', array('element' => 'MyPlugin.alert'));
|
$this->Flash->set('This is a test message', array('element' => 'MyPlugin.alert'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -95,6 +117,7 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
|
|
||||||
$this->Flash->set('This is a test message', array('key' => 'foobar'));
|
$this->Flash->set('This is a test message', array('key' => 'foobar'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -107,6 +130,7 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.foobar');
|
$result = CakeSession::read('Message.foobar');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.foobar');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,6 +152,7 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,6 +175,7 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,32 +188,41 @@ class FlashComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Flash->success('It worked');
|
$this->Flash->success('It worked');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
array(
|
||||||
'message' => 'It worked',
|
'message' => 'It worked',
|
||||||
'key' => 'flash',
|
'key' => 'flash',
|
||||||
'element' => 'Flash/success',
|
'element' => 'Flash/success',
|
||||||
'params' => array()
|
'params' => array()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
|
|
||||||
$this->Flash->alert('It worked', array('plugin' => 'MyPlugin'));
|
$this->Flash->alert('It worked', array('plugin' => 'MyPlugin'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
array(
|
||||||
'message' => 'It worked',
|
'message' => 'It worked',
|
||||||
'key' => 'flash',
|
'key' => 'flash',
|
||||||
'element' => 'MyPlugin.Flash/alert',
|
'element' => 'MyPlugin.Flash/alert',
|
||||||
'params' => array()
|
'params' => array()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
|
|
||||||
$this->Flash->error('It did not work', array('element' => 'error_thing'));
|
$this->Flash->error('It did not work', array('element' => 'error_thing'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
array(
|
||||||
'message' => 'It did not work',
|
'message' => 'It did not work',
|
||||||
'key' => 'flash',
|
'key' => 'flash',
|
||||||
'element' => 'Flash/error',
|
'element' => 'Flash/error',
|
||||||
'params' => array()
|
'params' => array()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
$result = CakeSession::read('Message.flash');
|
$result = CakeSession::read('Message.flash');
|
||||||
$this->assertEquals($expected, $result, 'Element is ignored in magic call.');
|
$this->assertEquals($expected, $result, 'Element is ignored in magic call.');
|
||||||
|
CakeSession::delete('Message.flash');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,21 @@ class FlashHelperTest extends CakeTestCase {
|
||||||
CakeSession::write(array(
|
CakeSession::write(array(
|
||||||
'Message' => array(
|
'Message' => array(
|
||||||
'flash' => array(
|
'flash' => array(
|
||||||
|
array(
|
||||||
'key' => 'flash',
|
'key' => 'flash',
|
||||||
'message' => 'This is a calling',
|
'message' => 'This is the first Message',
|
||||||
'element' => 'Flash/default',
|
'element' => 'Flash/default',
|
||||||
'params' => array()
|
'params' => array()
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'key' => 'flash',
|
||||||
|
'message' => 'This is the second Message',
|
||||||
|
'element' => 'Flash/default',
|
||||||
|
'params' => array()
|
||||||
|
)
|
||||||
|
),
|
||||||
'notification' => array(
|
'notification' => array(
|
||||||
|
array(
|
||||||
'key' => 'notification',
|
'key' => 'notification',
|
||||||
'message' => 'Broadcast message testing',
|
'message' => 'Broadcast message testing',
|
||||||
'element' => 'flash_helper',
|
'element' => 'flash_helper',
|
||||||
|
@ -70,14 +79,17 @@ class FlashHelperTest extends CakeTestCase {
|
||||||
'title' => 'Notice!',
|
'title' => 'Notice!',
|
||||||
'name' => 'Alert!'
|
'name' => 'Alert!'
|
||||||
)
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'classy' => array(
|
'classy' => array(
|
||||||
|
array(
|
||||||
'key' => 'classy',
|
'key' => 'classy',
|
||||||
'message' => 'Recorded',
|
'message' => 'Recorded',
|
||||||
'element' => 'flash_classy',
|
'element' => 'flash_classy',
|
||||||
'params' => array()
|
'params' => array()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +111,7 @@ class FlashHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testFlash() {
|
public function testFlash() {
|
||||||
$result = $this->Flash->render();
|
$result = $this->Flash->render();
|
||||||
$expected = '<div class="message">This is a calling</div>';
|
$expected = '<div class="message">This is the first Message</div><div class="message">This is the second Message</div>';
|
||||||
$this->assertContains($expected, $result);
|
$this->assertContains($expected, $result);
|
||||||
|
|
||||||
$expected = '<div id="classy-message">Recorded</div>';
|
$expected = '<div id="classy-message">Recorded</div>';
|
||||||
|
|
Loading…
Reference in a new issue