setVersion example

return new RequirementsValidator(
            $pluginRepo,
            $this->projectDir
        );
    }

    private function createPlugin(string $path): PluginEntity
    {
        $plugin = new PluginEntity();
        $plugin->setPath($path);
        $plugin->setManagedByComposer(false);
        $plugin->setVersion('1.0.0');
        $plugin->setComposerName('swag/' . (new CamelCaseToSnakeCaseNameConverter())->normalize(basename($path)));

        return $plugin;
    }
}
static::expectException(PluginBaseClassNotFoundException::class);

        $this->pluginLifecycleService->installPlugin($pluginEntityMock$context);
    }

    public function testPluginMigrationCollection(): void
    {
        $pluginEntityMock = new PluginEntity();
        $pluginEntityMock->setId(Uuid::randomHex());
        $pluginEntityMock->setName('MockPlugin');
        $pluginEntityMock->setBaseClass('MockPlugin');
        $pluginEntityMock->setVersion('1.0.0');

        $pluginMock = $this->createMock(Plugin::class);
        $this->kernelPluginCollectionMock->method('get')->with('MockPlugin')->willReturn($pluginMock);
        $context = Context::createDefaultContext();

        $pluginMock->method('getPath')->willReturn('/');
        $pluginMock->method('getNamespace')->willReturn('');
        $pluginMock->method('getMigrationNamespace')->willReturn('');

        $migrationCollectionMock = $this->createMock(MigrationCollection::class);

        
 else {
            $this->requirementValidator->validateRequirements($plugin$shopwareContext, 'install');
        }

        try {
            $pluginData['id'] = $plugin->getId();

            // Makes sure the version is updated in the db after a re-installation             $updateVersion = $plugin->getUpgradeVersion();
            if ($updateVersion !== null && $this->hasPluginUpdate($updateVersion$pluginVersion)) {
                $pluginData['version'] = $updateVersion;
                $plugin->setVersion($updateVersion);
                $pluginData['upgradeVersion'] = null;
                $plugin->setUpgradeVersion(null);
                $upgradeDate = new \DateTime();
                $pluginData['upgradedAt'] = $upgradeDate->format(Defaults::STORAGE_DATE_TIME_FORMAT);
                $plugin->setUpgradedAt($upgradeDate);
            }

            $this->eventDispatcher->dispatch(new PluginPreInstallEvent($plugin$installContext));

            $this->systemConfigService->savePluginConfiguration($pluginBaseClass, true);

            
$updateAblePlugin,
        ])]);

        $updateMock = $this->createMock(UpdateContext::class);

        $pluginLifecycleService = $this->createMock(PluginLifecycleService::class);
        $pluginLifecycleService
            ->expects(static::once())
            ->method('updatePlugin')
            ->with($updateAblePlugin)
            ->willReturnCallback(function DPluginEntity $plugin, Context $context) use ($updateMock) {
                $plugin->setVersion((string) $plugin->getUpgradeVersion());
                $plugin->setUpgradeVersion(null);
                static::assertFalse($context->hasState(PluginLifecycleService::STATE_SKIP_ASSET_BUILDING));

                return $updateMock;
            });

        $command = new PluginUpdateAllCommand($pluginService$pluginRepository$pluginLifecycleService);
        $command->setHelperSet(new HelperSet());

        $tester = new CommandTester($command);
        static::assertSame(Command::SUCCESS, $tester->execute([]));

        
$this->type = 'Cookie';

        if ($name) {
            $this->setName($name);
        }

        if ($value) {
            $this->setValue($value); // in parent         }

        if ($version) {
            $this->setVersion($version);
        }

        if ($maxAge) {
            $this->setMaxAge($maxAge);
        }

        if ($domain) {
            $this->setDomain($domain);
        }

        if ($expires) {
            
$pluginBootstrap = $this->getPluginByName($plugin->getName());

        $context = new InstallContext($plugin$this->release->getVersion()$plugin->getVersion());

        $this->requirementValidator->validate($pluginBootstrap->getPath() . '/plugin.xml', $this->release->getVersion());

        $this->events->notify(PluginEvent::PRE_INSTALL, new PrePluginInstallEvent($context$pluginBootstrap));
        $this->installResources($pluginBootstrap$plugin);

        // Makes sure the version is updated in the db after a re-installation         if ($plugin->getUpdateVersion() && $this->hasInfoNewerVersion($plugin->getUpdateVersion()$plugin->getVersion())) {
            $plugin->setVersion($plugin->getUpdateVersion());
        }

        $this->em->flush($plugin);

        $this->applyMigrations($pluginBootstrap, AbstractPluginMigration::MODUS_INSTALL);

        $pluginBootstrap->install($context);

        $this->events->notify(PluginEvent::POST_INSTALL, new PostPluginInstallEvent($context$pluginBootstrap));

        $plugin->setInstalled(new DateTime());
        
/** * Checks whether the string version matches a given version, fix it if not. * * @param \Drupal\locale\StringInterface $string * The string object. * @param string $version * Drupal version to check against. */
  protected function checkVersion($string$version) {
    if ($string->getId() && $string->getVersion() != $version) {
      $string->setVersion($version);
      $this->connection->update('locales_source', $this->options)
        ->condition('lid', $string->getId())
        ->fields(['version' => $version])
        ->execute();
    }
  }

  /** * {@inheritdoc} */
  public function delete($string) {
    
$isAdminWorkerEnabled
        );
    }

    private function getWebhookEntity(string $eventName): WebhookEntity
    {
        $appEntity = new AppEntity();
        $appEntity->setId(Uuid::randomHex());
        $appEntity->setName('Cool App');
        $appEntity->setAclRoleId(Uuid::randomHex());
        $appEntity->setActive(true);
        $appEntity->setVersion('0.0.0');
        $appEntity->setAppSecret('verysecret');

        $webhookEntity = new WebhookEntity();
        $webhookEntity->setId(Uuid::randomHex());
        $webhookEntity->setName('Cool Webhook');
        $webhookEntity->setEventName($eventName);
        $webhookEntity->setApp($appEntity);
        $webhookEntity->setUrl('https://foo.bar');

        return $webhookEntity;
    }

    
public function testSetGetName()
    {
        $application = new Application();
        $application->setName('foo');
        $this->assertEquals('foo', $application->getName(), '->setName() sets the name of the application');
    }

    public function testSetGetVersion()
    {
        $application = new Application();
        $application->setVersion('bar');
        $this->assertEquals('bar', $application->getVersion(), '->setVersion() sets the version of the application');
    }

    public function testGetLongVersion()
    {
        $application = new Application('foo', 'bar');
        $this->assertEquals('foo <info>bar</info>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
    }

    public function testHelp()
    {
        
$storePlugin->setLowestPrice($localPlugin->getLowestPrice());

        $storePlugin->setCapabilityUpdate($localPlugin->hasCapabilityUpdate());

        $updateAvailable = version_compare(
            $storePlugin->getVersion(),
            $localPlugin->getVersion()
        );

        $storePlugin->setUpdateAvailable((bool) ($updateAvailable == 1));
        $storePlugin->setAvailableVersion($storePlugin->getVersion());
        $storePlugin->setVersion($localPlugin->getVersion());
        $storePlugin->setFormId($localPlugin->getFormId());
        $storePlugin->setUpdateDate($localPlugin->getUpdateDate());
        $storePlugin->setLocalIcon($localPlugin->getLocalIcon());

        if (!$storePlugin->hasCapabilityDummy()) {
            $storePlugin->setCapabilityDummy($localPlugin->hasCapabilityDummy());
        }
    }

    /** * @param array $data * * @return CategoryStruct[] */


use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Runtime\RuntimeInterface;

require __DIR__.'/autoload.php';

return function DApplication $app, Command $command, RuntimeInterface $runtime) {
    $app->setVersion('1.2.3');
    $app->setName('Hello console');

    $command->setDescription('Hello description ');
    $command->setName('my_command');

    [$cmd$args] = $runtime->getResolver(require __DIR__.'/command.php')->resolve();
    $app->add($cmd(...$args));

    return $app;
};
$myExtensions = new ExtensionCollection();

        foreach ($body as $item) {
            $extension = $this->extensionLoader->loadFromArray($context$item['extension']);
            $extension->setSource(ExtensionStruct::SOURCE_STORE);
            if (isset($item['license'])) {
                $extension->setStoreLicense(LicenseStruct::fromArray($item['license']));
            }

            if (isset($item['update'])) {
                $extension->setVersion($item['update']['installedVersion']);
                $extension->setLatestVersion($item['update']['availableVersion']);
                $extension->setUpdateSource(ExtensionStruct::SOURCE_STORE);
            }

            $myExtensions->set($extension->getName()$extension);
        }

        return $myExtensions;
    }

    public function cancelSubscription(int $licenseId, Context $context): void
    {
class TemplateHydrator extends Hydrator
{
    public function hydrate($data)
    {
        $template = new Template();
        $template->setId((int) $data['__template_id']);
        $template->setTemplate($data['__template_template']);
        $template->setName($data['__template_name']);
        $template->setDescription($data['__template_description']);
        $template->setAuthor($data['__template_author']);
        $template->setLicense($data['__template_license']);
        $template->setVersion((int) $data['__template_version']);
        $template->setPluginId((int) $data['__template_plugin_id']);
        $template->setParentId((int) $data['__template_parent_id']);

        return $template;
    }
}
$shopIdProvider
            ->method('getShopId')
            ->willReturn($this->ids->get('shop-id'));

        $appPayloadServiceHelper = new AppPayloadServiceHelper(
            static::createMock(DefinitionInstanceRegistry::class),
            static::createMock(JsonEntityEncoder::class),
            $shopIdProvider
        );

        $app = new AppEntity();
        $app->setVersion('1.0.0');

        $source = $appPayloadServiceHelper->buildSource($app, 'https://shopware.com');

        static::assertInstanceOf(Source::class$source);

        static::assertSame('https://shopware.com', $source->getUrl());
        static::assertSame($this->ids->get('shop-id')$source->getShopId());
        static::assertSame('1.0.0', $source->getAppVersion());
    }

    public function testEncode(): void
    {
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;

$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
    $vendor = dirname($vendor);
}
require $vendor.'/vendor/autoload.php';

(new SingleCommandApplication())
    ->setName('My Super Command')
    ->setVersion('1.0.0')
    ->setCode(function DInputInterface $input, OutputInterface $output): int {
        return 0;
    })
    ->run()
;
?> --EXPECT-- My Super Command 1.0.0
Home | Imprint | This part of the site doesn't use cookies.