mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Improve code readability for exists method (#5022)
This commit is contained in:
parent
9aa6b9d9d1
commit
600fbd7cfa
@ -338,7 +338,7 @@ class PluginManager
|
||||
*/
|
||||
public function exists($id)
|
||||
{
|
||||
return !(!$this->findByIdentifier($id) || $this->isDisabled($id));
|
||||
return $this->findByIdentifier($id) && !$this->isDisabled($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,4 +225,19 @@ class PluginManagerTest extends TestCase
|
||||
$result = $this->manager->isDisabled('dependencytest.notfound');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testExists()
|
||||
{
|
||||
$result = $this->manager->exists('DependencyTest.Found');
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->manager->exists('DependencyTest.WrongCase');
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result = $this->manager->exists('DependencyTest.NotFound');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$result = $this->manager->exists('Unknown.Plugin');
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user