removeBehavior() public method

Example: Remove a behavior from this table. $this->removeBehavior('Tree');
See also: Cake\ORM\Behavior
public removeBehavior ( string $name ) : void
$name string The alias that the behavior was added with.
return void
 /**
  * tear down
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $this->Noticias->removeBehavior("CakePtbr.AjusteData");
     unset($this->Noticias, $this->Noticias);
     TableRegistry::clear();
 }
Example #2
0
 /**
  * Test removing a behavior from a table.
  *
  * @return void
  */
 public function testRemoveBehavior()
 {
     $mock = $this->getMock('Cake\\ORM\\BehaviorRegistry', [], [], '', false);
     $mock->expects($this->once())->method('unload')->with('Sluggable');
     $table = new Table(['table' => 'articles', 'behaviors' => $mock]);
     $table->removeBehavior('Sluggable');
 }
Example #3
0
 /**
  * Test removing a behavior from a table.
  *
  * @return void
  */
 public function testRemoveBehavior()
 {
     $mock = $this->getMockBuilder('Cake\\ORM\\BehaviorRegistry')->disableOriginalConstructor()->getMock();
     $mock->expects($this->once())->method('unload')->with('Sluggable');
     $table = new Table(['table' => 'articles', 'behaviors' => $mock]);
     $table->removeBehavior('Sluggable');
 }