Browse Source

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

Jose Lorenzo Rodriguez 14 years ago
parent
commit
b9ad469a65

+ 1 - 0
app/webroot/css/cake.generic.css

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

+ 1 - 0
lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css

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

+ 1 - 1
lib/Cake/Model/Model.php

@@ -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) {

+ 12 - 0
lib/Cake/Test/Case/Model/ModelIntegrationTest.php

@@ -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());
+	}
 }

+ 1 - 0
lib/Cake/TestSuite/templates/phpunit.php

@@ -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>