|
|
@@ -365,31 +365,27 @@ class BehaviorRegistryTest extends TestCase
|
|
|
/**
|
|
|
* Test that unloading a none existing behavior triggers an error.
|
|
|
*
|
|
|
- * This should produce an "Behavior "Foo" was not loaded before." error
|
|
|
- * which gets thrown as a \PHPUnit\Framework\Error\Error Exception by PHPUnit.
|
|
|
- *
|
|
|
- * @expectedException \PHPUnit\Framework\Error\Error
|
|
|
- * @expectedExceptionMessage Object "Foo" was not loaded before.
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testUnloadUnknown()
|
|
|
+ public function testUnload()
|
|
|
{
|
|
|
- $this->Behaviors->unload('Foo');
|
|
|
+ $this->Behaviors->load('Sluggable');
|
|
|
+ $this->Behaviors->unload('Sluggable');
|
|
|
+
|
|
|
+ $this->assertEmpty($this->Behaviors->loaded());
|
|
|
+ $this->assertCount(0, $this->EventManager->listeners('Model.beforeFind'));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Test that unloading a none existing plugin behavior triggers an error.
|
|
|
- *
|
|
|
- * This should produce an "Behavior "Plugin.Foo" was not loaded before. Remember to omit plugin prefixes." error
|
|
|
- * which gets thrown as a \PHPUnit\Framework\Error\Error Exception by PHPUnit.
|
|
|
+ * Test that unloading a none existing behavior triggers an error.
|
|
|
*
|
|
|
- * @expectedException \PHPUnit\Framework\Error\Error
|
|
|
- * @expectedExceptionMessage Object "Plugin.Foo" was not loaded before. Remember to omit plugin prefixes.
|
|
|
+ * @expectedException \Cake\ORM\Exception\MissingBehaviorException
|
|
|
+ * @expectedExceptionMessage Behavior class FooBehavior could not be found.
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testUnloadUnknownPluginBehavior()
|
|
|
+ public function testUnloadUnknown()
|
|
|
{
|
|
|
- $this->Behaviors->unload('Plugin.Foo');
|
|
|
+ $this->Behaviors->unload('Foo');
|
|
|
}
|
|
|
|
|
|
/**
|