Xpressengine\Plugin\PluginEntity::getDependencies PHP Method

getDependencies() public method

플러그인의 의존성정보를 조회한다.
public getDependencies ( ) : string[]
return string[]
    public function getDependencies()
    {
        // 이미 dependency 자료는 모두 composer를 통해 설치돼 있다고 가정한다.
        $dependencies = $this->getMetaData('require');
        if ($dependencies === null) {
            $dependencies = [];
        }
        $collection = $this->getCollection();
        $dependencyPlugins = [];
        foreach ($dependencies as $dependency => $version) {
            list($venacdor, $id) = explode('/', $dependency);
            $entity = $collection->get($id);
            if ($entity !== null && $entity->getName() === $dependency) {
                $dependencyPlugins[$id] = $entity;
            }
        }
        return $dependencyPlugins;
    }

Usage Example

 /**
  * @depends testConstruct
  *
  * @param \Xpressengine\Plugin\PluginEntity $entity
  */
 public function testGetDependencies($entity)
 {
     $collection = Mockery::mock('\\Xpressengine\\Plugin\\PluginCollection');
     $collection->shouldReceive('get')->withArgs(['ncenter'])->once()->andReturnNull();
     $entity->setCollection($collection);
     $this->assertEmpty($entity->getDependencies());
 }