コード例 #1
0
ファイル: OrderStateMachineTest.php プロジェクト: spryker/Oms
 /**
  * @return void
  */
 public function testInstantiationWithCommandCollection()
 {
     $commandCollection = new CommandCollection();
     $commandCollection->add($this->getCommandMock(), self::COMMAND_NAME);
     $orderStateMachine = new OrderStateMachine($this->getQueryContainerMock(), $this->getBuilderMock(), $this->getTransitionLogMock(), $this->getTimeoutMock(), new ReadOnlyArrayObject(), [], $commandCollection);
     $reflection = new \ReflectionClass(OrderStateMachine::class);
     $reflectionProperty = $reflection->getProperty('commands');
     $reflectionProperty->setAccessible(true);
     $commands = $reflectionProperty->getValue($orderStateMachine);
     $this->assertInstanceOf(CommandCollectionInterface::class, $commands);
     $this->assertInstanceOf(CommandInterface::class, $commands->get(self::COMMAND_NAME));
 }
コード例 #2
0
ファイル: DrawerTest.php プロジェクト: spryker/Oms
 /**
  * @return void
  */
 public function testInstantiationWithCommandCollection()
 {
     $commandCollection = new CommandCollection();
     $commandCollection->add($this->getCommandMock(), self::COMMAND_NAME);
     $drawer = new Drawer($commandCollection, [], $this->getGraphMock());
     $reflection = new \ReflectionClass(Drawer::class);
     $reflectionProperty = $reflection->getProperty('commands');
     $reflectionProperty->setAccessible(true);
     $commands = $reflectionProperty->getValue($drawer);
     $this->assertInstanceOf(CommandCollectionInterface::class, $commands);
     $this->assertInstanceOf(CommandInterface::class, $commands->get(self::COMMAND_NAME));
 }
コード例 #3
0
ファイル: Drawer.php プロジェクト: spryker/Oms
 /**
  * @param \Spryker\Zed\Oms\Business\Process\TransitionInterface $transition
  * @param string $label
  *
  * @return array
  */
 protected function addEdgeEventText(TransitionInterface $transition, $label)
 {
     if ($transition->hasEvent()) {
         $event = $transition->getEvent();
         if ($event->isOnEnter()) {
             $label[] = '<b>' . $event->getName() . ' (on enter)</b>';
         } else {
             $label[] = '<b>' . $event->getName() . '</b>';
         }
         if ($event->hasTimeout()) {
             $label[] = 'timeout: ' . $event->getTimeout();
         }
         if ($event->hasCommand()) {
             $commandLabel = 'c:' . $event->getCommand();
             if ($this->commands->has($event->getCommand())) {
                 $commandModel = $this->commands->get($event->getCommand());
                 if ($commandModel instanceof CommandByOrderInterface) {
                     $commandLabel .= ' (by order)';
                 } else {
                     $commandLabel .= ' (by item)';
                 }
             } else {
                 $commandLabel .= ' ' . $this->notImplemented;
             }
             $label[] = $commandLabel;
         }
         if ($event->isManual()) {
             $label[] = 'manually executable';
         }
     } else {
         $label[] = '&infin;';
     }
     return $label;
 }
コード例 #4
0
ファイル: OrderStateMachine.php プロジェクト: spryker/Oms
 /**
  * Converts array to collection for BC
  *
  * @param \Spryker\Zed\Oms\Communication\Plugin\Oms\Command\CommandCollectionInterface|array $commands
  *
  * @return void
  */
 protected function setCommands($commands)
 {
     if ($commands instanceof CommandCollectionInterface) {
         $this->commands = $commands;
         return;
     }
     $commandCollection = new CommandCollection();
     foreach ($commands as $name => $command) {
         $commandCollection->add($command, $name);
     }
     $this->commands = $commandCollection;
 }
コード例 #5
0
ファイル: CommandCollectionTest.php プロジェクト: spryker/Oms
 /**
  * @return void
  */
 public function testGetShouldThrowException()
 {
     $commandCollection = new CommandCollection();
     $this->expectException(CommandNotFoundException::class);
     $commandCollection->get(self::COMMAND_NAME);
 }