/** * @param string|PackageInterface $package * * @return Package */ public function add($package) { if (!$package instanceof PackageInterface) { $name = $package; $package = Package::create($name); } $this->put($package->getName(), $package); return $package; }
/** * @covers \KodiCMS\Assets\Package::with * @covers \KodiCMS\Assets\Package::hasDependencies * @covers \KodiCMS\Assets\Package::getDependencies * @covers \KodiCMS\Assets\Package::addDependency */ public function tesDependencies() { $package = \KodiCMS\Assets\Package::create('test'); static::assertFalse($package->hasDependencies()); static::assertEquals([], $package->getDependencies()); $package->with('test1', 'test2'); static::assertEquals(['test1', 'test2'], $package->getDependencies()); static::assertTrue($package->hasDependencies()); $package->addDependency('test3', 'test4'); static::assertEquals(['test1', 'test2', 'test3', 'test4'], $package->getDependencies()); }