Skip to content
Permalink
Browse files

add tests for aliased behavior methods

  • Loading branch information...
AD7six committed Nov 6, 2013
1 parent 1c7924e commit be2d45635d46d0707f90df95d9992eb71705cc0e
Showing with 29 additions and 0 deletions.
  1. +29 −0 Cake/Test/TestCase/ORM/TableTest.php
@@ -984,6 +984,17 @@ public function testCallBehaviorMethod() {
$this->assertEquals('some_value', $table->slugify('some value'));
}
/**
* Test you can alias a behavior method
*
* @return void
*/
public function testCallBehaviorAliasedMethod() {
$table = TableRegistry::get('article');
$table->addBehavior('Sluggable', ['implementedMethods' => ['wednesday' => 'slugify']]);
$this->assertEquals('some_value', $table->wednesday('some value'));
}
/**
* Test finder methods from behaviors.
*
@@ -998,6 +1009,24 @@ public function testCallBehaviorFinder() {
$this->assertNotEmpty($query->clause('where'));
}
/**
* testCallBehaviorAliasedFinder
*
* @return void
*/
public function testCallBehaviorAliasedFinder() {
$table = TableRegistry::get('article');
$table->addBehavior('Sluggable', ['implementedFinders' => ['special' => 'findNoSlug']]);
$query = $table->special();
$this->assertInstanceOf('Cake\ORM\Query', $query);
$this->assertNotEmpty($query->clause('where'));
$query = $table->find('special');
$this->assertInstanceOf('Cake\ORM\Query', $query);
$this->assertNotEmpty($query->clause('where'));
}
/**
* Tests that it is possible to insert a new row using the save method
*

0 comments on commit be2d456

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