Permalink
Browse files

Stub out schema in mocked tables.

This fixes fatal errors when accessing schema data.
  • Loading branch information...
1 parent 5733364 commit 04e9123188dde2698ab81ad46cf8cfc57e208a84 @markstory markstory committed Mar 2, 2014
Showing with 8 additions and 0 deletions.
  1. +8 −0 tests/TestCase/ORM/TableTest.php
View
8 tests/TestCase/ORM/TableTest.php
@@ -3117,6 +3117,8 @@ public function testValidateDefaultAssociations() {
$table = $this->getMock('\Cake\ORM\Table', ['entityValidator']);
$table->belongsTo('users');
$table->hasMany('articles');
+ $table->schema([]);
+
$entityValidator = $this->getMock('\Cake\ORM\EntityValidator', [], [$table]);
$entity = $table->newEntity([]);
@@ -3136,6 +3138,8 @@ public function testValidateDefaultAssociations() {
*/
public function testValidateWithCustomOptions() {
$table = $this->getMock('\Cake\ORM\Table', ['entityValidator']);
+ $table->schema([]);
+
$entityValidator = $this->getMock('\Cake\ORM\EntityValidator', [], [$table]);
$entity = $table->newEntity([]);
$options = ['associated' => ['users'], 'validate' => 'foo'];
@@ -3158,6 +3162,8 @@ public function testValidateManyDefaultAssociaion() {
$table = $this->getMock('\Cake\ORM\Table', ['entityValidator']);
$table->belongsTo('users');
$table->hasMany('articles');
+ $table->schema([]);
+
$entityValidator = $this->getMock('\Cake\ORM\EntityValidator', [], [$table]);
$entities = ['a', 'b'];
@@ -3177,6 +3183,8 @@ public function testValidateManyDefaultAssociaion() {
*/
public function testValidateManyWithCustomOptions() {
$table = $this->getMock('\Cake\ORM\Table', ['entityValidator']);
+ $table->schema([]);
+
$entityValidator = $this->getMock('\Cake\ORM\EntityValidator', [], [$table]);
$entities = ['a', 'b', 'c'];
$options = ['associated' => ['users'], 'validate' => 'foo'];

0 comments on commit 04e9123

Please sign in to comment.