assertInstanceof('Cake\Auth\DefaultPasswordHasher', $hasher); $hasher = PasswordHasherFactory::build([ 'className' => 'Default', 'hashOptions' => ['foo' => 'bar'] ]); $this->assertInstanceof('Cake\Auth\DefaultPasswordHasher', $hasher); $this->assertEquals(['foo' => 'bar'], $hasher->getConfig('hashOptions')); Plugin::load('TestPlugin'); $hasher = PasswordHasherFactory::build('TestPlugin.Legacy'); $this->assertInstanceof('TestPlugin\Auth\LegacyPasswordHasher', $hasher); } /** * test build() throws exception for non existent hasher * * @return void */ public function testBuildException() { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Password hasher class "FooBar" was not found.'); $hasher = PasswordHasherFactory::build('FooBar'); } }