Browse Source

Improve error message.

Fixture datasources must begin with test so you don't accidentally use
a real datasource.

Fixes #3254
mark_story 13 years ago
parent
commit
972d5752bf
1 changed files with 7 additions and 1 deletions
  1. 7 1
      lib/Cake/TestSuite/Fixture/CakeTestFixture.php

+ 7 - 1
lib/Cake/TestSuite/Fixture/CakeTestFixture.php

@@ -75,7 +75,13 @@ class CakeTestFixture {
 		if (!empty($this->useDbConfig)) {
 			$connection = $this->useDbConfig;
 			if (strpos($connection, 'test') !== 0) {
-				throw new CakeException(__d('cake_dev', 'Invalid datasource %s for object %s', $connection, $this->name));
+				$message = __d(
+					'cake_dev',
+					'Invalid datasource name "%s" for "%s" fixture. Fixture datasource names must begin with "test".',
+					$connection,
+					$this->name
+				);
+				throw new CakeException($message);
 			}
 		}
 		$this->Schema = new CakeSchema(array('name' => 'TestSuite', 'connection' => $connection));