Skip to content
Permalink
Browse files

Add tests for previous commit.

  • Loading branch information...
ADmad committed Feb 27, 2016
1 parent 2d44ca9 commit fde081f105664d435d39bafb031a1f10e4c593e1
Showing with 42 additions and 0 deletions.
  1. +42 −0 tests/TestCase/ORM/AssociationTest.php
@@ -329,6 +329,48 @@ public function testProperty()
$this->assertEquals('thing', $this->association->property());
}
/**
* Test that warning is shown if property name clashes with table field.
*
* @return void
* @expectedException PHPUnit_Framework_Error_Warning
*/
public function testPropertyNameClash()
{
$this->source->schema(['foo' => ['type' => 'string']]);
$this->assertEquals('foo', $this->association->property());
}
/**
* Test that warning is not shown if "propertyName" option is explicitly specified.
*
* @return void
*/
public function testPropertyNameExplicitySet()
{
$this->source->schema(['foo' => ['type' => 'string']]);
$config = [
'className' => '\Cake\Test\TestCase\ORM\TestTable',
'foreignKey' => 'a_key',
'conditions' => ['field' => 'value'],
'dependent' => true,
'sourceTable' => $this->source,
'joinType' => 'INNER',
'propertyName' => 'foo'
];
$association = $this->getMock(
'\Cake\ORM\Association',
[
'_options', 'attachTo', '_joinCondition', 'cascadeDelete', 'isOwningSide',
'saveAssociated', 'eagerLoader', 'type'
],
['Foo', $config]
);
$this->assertEquals('foo', $association->property());
}
/**
* Tests strategy method
*

0 comments on commit fde081f

Please sign in to comment.
You can’t perform that action at this time.