magic_db.test.php

来自「Cake Framwork , Excellent」· PHP 代码 · 共 180 行 · 第 1/5 页

PHP
180 行
字号
/** * MagicDb::toArray should either return the MagicDb::db property, or the parsed array data if a magic.db dump is passed in as the first argument * * @access public */	function testToArray() {		$this->Db->db = array();		$r = $this->Db->toArray();		$this->assertTrue($r === array());		$this->Db->db = array('foo' => 'bar');		$r = $this->Db->toArray();		$this->assertTrue($r === array('foo' => 'bar'));		$r = $this->Db->toArray(array('yeah'));		$this->assertTrue($r === array('yeah'));		$r = $this->Db->toArray('foo');		$this->assertTrue($r === array());		$r = $this->Db->toArray(MagicDbTestData::get('magic.snippet.db'));		$this->assertTrue($r === MagicDbTestData::get('magic.snippet.db.result'));	}/** * The MagicDb::validates function should return if the array passed to it or the local db property contains a valid MagicDb record set * * @access public */	function testValidates() {		$r = $this->Db->validates(array());		$this->assertTrue($r === false);		$r = $this->Db->validates(array('header' => true, 'database' => true));		$this->assertTrue($r === false);		$magicDb = array('header' => array(), 'database' => array());

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?