mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
c32e165052
commit
9be725613e
3 changed files with 31 additions and 0 deletions
|
@ -1425,6 +1425,17 @@ class ViewTest extends CakeTestCase {
|
|||
$this->assertSame('', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test checking a block's existance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBlockExist() {
|
||||
$this->assertFalse($this->View->exists('test'));
|
||||
$this->View->assign('test', 'Block content');
|
||||
$this->assertTrue($this->View->exists('test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test setting a block's content to null
|
||||
*
|
||||
|
|
|
@ -698,6 +698,16 @@ class View extends Object {
|
|||
return $this->Blocks->get($name, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block exists
|
||||
*
|
||||
* @param string $name Name of the block
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($name) {
|
||||
return $this->Blocks->exists($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* End a capturing block. The compliment to View::start()
|
||||
*
|
||||
|
|
|
@ -196,6 +196,16 @@ class ViewBlock {
|
|||
return $this->_blocks[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a block exists
|
||||
*
|
||||
* @param string $name Name of the block
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($name) {
|
||||
return isset($this->_blocks[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the names of all the existing blocks.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue