Merge remote-tracking branch 'origin/2.0' into 2.1

This commit is contained in:
Jose Lorenzo Rodriguez 2012-01-22 15:52:54 -04:30
commit b9ad469a65
5 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,4 @@
@charset "utf-8";
/**
*
* Generic CSS for CakePHP

View file

@ -1,3 +1,4 @@
@charset "utf-8";
/**
*
* Generic CSS for CakePHP

View file

@ -1274,7 +1274,7 @@ class Model extends Object implements CakeEventListener {
* @return array Array of table metadata
*/
public function schema($field = false) {
if (!is_array($this->_schema) || $field === true) {
if ($this->useTable !== false && (!is_array($this->_schema) || $field === true)) {
$db = $this->getDataSource();
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
if (method_exists($db, 'describe') && $this->useTable !== false) {

View file

@ -2319,4 +2319,16 @@ class ModelIntegrationTest extends BaseModelTest {
$this->assertEquals(true, count($armorsPlayers) > 1);
}
/**
* Tests that calling schema() on a model that is not supposed to use a table
* does not trigger any calls on any datasource
*
* @return void
**/
public function testSchemaNoDB() {
$model = $this->getMock('Article', array('getDataSource'));
$model->useTable = false;
$model->expects($this->never())->method('getDataSource');
$this->assertEmpty($model->schema());
}
}

View file

@ -30,6 +30,7 @@
<li><code>pear channel-discover pear.symfony-project.com</code></li>
<li><code>pear install phpunit/PHPUnit-3.6.4</code></li>
</ul>
<p>Once PHPUnit is installed make sure its located on PHP's <code>include_path</code> by checking your php.ini</p>
<p>For full instructions on how to <a href="http://www.phpunit.de/manual/current/en/installation.html">install PHPUnit, see the PHPUnit installation guide</a>.</p>
<p><a href="http://github.com/sebastianbergmann/phpunit" target="_blank">Download PHPUnit</a></p>
</div>