/**
  * @return void
  */
 public function testHasShouldReturnTrue()
 {
     $conditionCollection = new ConditionCollection();
     $condition = $this->getConditionMock();
     $conditionCollection->add($condition, self::CONDITION_NAME);
     $this->assertTrue($conditionCollection->has(self::CONDITION_NAME));
 }
 /**
  * @return void
  */
 public function testInstantiationWithConditionCollection()
 {
     $conditionCollection = new ConditionCollection();
     $conditionCollection->add($this->getConditionMock(), self::CONDITION_NAME);
     $orderStateMachine = new OrderStateMachine($this->getQueryContainerMock(), $this->getBuilderMock(), $this->getTransitionLogMock(), $this->getTimeoutMock(), new ReadOnlyArrayObject(), $conditionCollection, []);
     $reflection = new \ReflectionClass(OrderStateMachine::class);
     $reflectionProperty = $reflection->getProperty('conditions');
     $reflectionProperty->setAccessible(true);
     $conditions = $reflectionProperty->getValue($orderStateMachine);
     $this->assertInstanceOf(ConditionCollectionInterface::class, $conditions);
     $this->assertInstanceOf(ConditionInterface::class, $conditions->get(self::CONDITION_NAME));
 }
Exemple #3
0
 /**
  * @return void
  */
 public function testInstantiationWithConditionCollection()
 {
     $conditionCollection = new ConditionCollection();
     $conditionCollection->add($this->getConditionMock(), self::CONDITION_NAME);
     $drawer = new Drawer([], $conditionCollection, $this->getGraphMock());
     $reflection = new \ReflectionClass(Drawer::class);
     $reflectionProperty = $reflection->getProperty('conditions');
     $reflectionProperty->setAccessible(true);
     $conditions = $reflectionProperty->getValue($drawer);
     $this->assertInstanceOf(ConditionCollectionInterface::class, $conditions);
     $this->assertInstanceOf(ConditionInterface::class, $conditions->get(self::CONDITION_NAME));
 }
Exemple #4
0
 /**
  * Converts array to collection for BC
  *
  * @param \Spryker\Zed\Oms\Communication\Plugin\Oms\Condition\ConditionCollectionInterface|array $conditions
  *
  * @return void
  */
 protected function setConditions($conditions)
 {
     if ($conditions instanceof ConditionCollectionInterface) {
         $this->conditions = $conditions;
         return;
     }
     $conditionCollection = new ConditionCollection();
     foreach ($conditions as $name => $condition) {
         $conditionCollection->add($condition, $name);
     }
     $this->conditions = $conditionCollection;
 }