Exemplo n.º 1
0
 /**
  * @dataProvider provideInvalidConfiguration
  */
 public function testInvalidConfiguration(array $extras, $exceptionMessage)
 {
     $this->package->getExtra()->willReturn($extras);
     chdir(__DIR__);
     $this->setExpectedException('InvalidArgumentException', $exceptionMessage);
     ScriptHandler::buildParameters($this->event->reveal());
 }
 /**
  * Calls to \Incenteev\ParameterHandler\ScriptHandler if bootstrap.yml and/or doctrine.yml are not
  * created
  *
  * @param  CommandEvent $event
  */
 public static function buildParameters(CommandEvent $event)
 {
     if (true === self::getOptions($event)['prompt'] && (!is_file(self::bootstrapFilepath()) || !is_file(self::doctrineConfigFilepath()) || !is_file(self::servicesFilepath()))) {
         \Incenteev\ParameterHandler\ScriptHandler::buildParameters($event);
         self::$extraParams = self::readYamlFile(self::parametersFilepath())['parameters'];
     }
 }
Exemplo n.º 3
0
 public static function buildParameters(Event $event)
 {
     ScriptHandler::buildParameters($event);
     $extras = $event->getComposer()->getPackage()->getExtra();
     if (!isset($extras['aliexpress-open'])) {
         throw new \InvalidArgumentException('The parameter handler needs to be configured through the extra.aliexpress-open setting.');
     }
     $configs = $extras['aliexpress-open'];
     if (!is_array($configs)) {
         throw new \InvalidArgumentException('The extra.aliexpress-open setting must be an array or a configuration object.');
     }
     if (!file_exists($configs['file']) && file_exists($extras['incenteev-parameters']['file'])) {
         $YamlParser = new Parser();
         $YamlValues = $YamlParser->parse(file_get_contents($extras['incenteev-parameters']['file']));
         $params = ['client_id' => $YamlValues[$extras['incenteev-parameters']['parameter-key']]['appKey'], 'redirect_uri' => 'urn:ietf:wg:oauth:2.0:oob', 'site' => 'aliexpress'];
         ksort($params);
         $paramsForSign = $params;
         array_walk($paramsForSign, function (&$value, $key) {
             $value = $key . $value;
         });
         $params[Api::SIGN_PARAM] = Sign::getSignString(implode("", $paramsForSign), $YamlValues[$extras['incenteev-parameters']['parameter-key']]['appKeySecret']);
         $link = "http://gw.api.alibaba.com/auth/authorize.htm?" . http_build_query($params, null, '&', PHP_QUERY_RFC3986);
         $event->getIO()->write('<comment>Goto ' . $link . ' and get temporary auth code.</comment>');
         $processor = new Processor($event->getIO());
         $processor->processFile($configs);
     }
 }
Exemplo n.º 4
0
 public static function postInstall(CommandEvent $event)
 {
     chmod(__DIR__ . '/cache', 0777);
     chmod(__DIR__ . '/logs', 0777);
     chmod(__DIR__ . '/console', 0500);
     IncenteevScriptHandler::buildParameters($event);
 }