Skip to content
Permalink
Browse files

Added tests

  • Loading branch information...
robertpustulka committed Feb 7, 2017
1 parent 5054535 commit 04e17b3e01a8104cf8c79087071dccf21e5610dd
Showing with 36 additions and 0 deletions.
  1. +36 −0 tests/TestCase/ORM/AssociationTest.php
@@ -110,6 +110,42 @@ public function testName()
$this->assertEquals('Bar', $this->association->name());
}
/**
* Tests that setName() succeeds before the target table is resolved.
*
* @return void
*/
public function testSetNameBeforeTarget()
{
$this->association->setName('Bar');
$this->assertEquals('Bar', $this->association->getName());
}
/**
* Tests that setName() fails after the target table is resolved.
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Association name does not match target table alias.
* @return void
*/
public function testSetNameAfterTarger()
{
$this->association->getTarget();
$this->association->setName('Bar');
}
/**
* Tests that setName() succeeds if name equals target table alias.
*
* @return void
*/
public function testSetNameToTargetAlias()
{
$alias = $this->association->getTarget()->getAlias();
$this->association->setName($alias);
$this->assertEquals($alias, $this->association->getName());
}
/**
* Tests that className() returns the correct association className
*

0 comments on commit 04e17b3

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