Example:
Remove a behavior from this table.
$this->removeBehavior('Tree');
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(); }
/** * 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'); }
/** * 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'); }