当前位置: 首页>>代码示例>>PHP>>正文


PHP StepExecution::getExecutionContext方法代码示例

本文整理汇总了PHP中Akeneo\Bundle\BatchBundle\Entity\StepExecution::getExecutionContext方法的典型用法代码示例。如果您正苦于以下问题:PHP StepExecution::getExecutionContext方法的具体用法?PHP StepExecution::getExecutionContext怎么用?PHP StepExecution::getExecutionContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Akeneo\Bundle\BatchBundle\Entity\StepExecution的用法示例。


在下文中一共展示了StepExecution::getExecutionContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetSetExecutionContext

 public function testGetSetExecutionContext()
 {
     $this->assertEquals(new ExecutionContext(), $this->stepExecution->getExecutionContext());
     $expectedExecutionContext = new ExecutionContext();
     $expectedExecutionContext->put('key', 'value');
     $this->assertEntity($this->stepExecution->setExecutionContext($expectedExecutionContext));
     $this->assertSame($expectedExecutionContext, $this->stepExecution->getExecutionContext());
 }
开发者ID:xleliberty,项目名称:BatchBundle,代码行数:8,代码来源:StepExecutionTest.php

示例2: testRead

 /**
  * @dataProvider readItemDatesDataProvider
  *
  * @param string  $dateInContext
  * @param string  $dateInItem
  * @param string  $expectedDate
  * @param boolean $hasData
  * @param string  $dateInIterator
  */
 public function testRead($dateInContext, $dateInItem, $expectedDate, $hasData = true, $dateInIterator = null)
 {
     $iteratorMock = $this->getMock('OroCRM\\Bundle\\MagentoBundle\\Provider\\Iterator\\UpdatedLoaderInterface');
     $connector = $this->getConnector($this->transportMock, $this->stepExecutionMock);
     $this->transportMock->expects($this->at(0))->method($this->getIteratorGetterMethodName())->will($this->returnValue($iteratorMock));
     $connector->setStepExecution($this->stepExecutionMock);
     $context = $this->stepExecutionMock->getExecutionContext();
     $context->put(ConnectorInterface::CONTEXT_CONNECTOR_DATA_KEY, ['lastSyncItemDate' => $dateInContext]);
     $testValue = ['created_at' => '01.01.2200 14:15:08', 'updatedAt' => $dateInItem];
     if ($hasData) {
         $context->put(ConnectorInterface::CONTEXT_CONNECTOR_DATA_KEY, ['lastSyncItemDate' => $dateInContext]);
         $iteratorMock->expects($this->once())->method('rewind');
         $iteratorMock->expects($this->once())->method('next');
         $iteratorMock->expects($this->any())->method('valid')->will($this->onConsecutiveCalls(true, false));
         $iteratorMock->expects($this->once())->method('current')->will($this->returnValue($testValue));
         $this->assertEquals($testValue, $connector->read());
     } else {
         $context->put(ConnectorInterface::CONTEXT_CONNECTOR_DATA_KEY, ['lastSyncItemDate' => $dateInIterator]);
         $iteratorMock->expects($this->once())->method('rewind');
         $iteratorMock->expects($this->never())->method('next');
         $iteratorMock->expects($this->any())->method('valid')->will($this->returnValue(false));
         $iteratorMock->expects($this->never())->method('current')->will($this->returnValue(null));
         $iteratorMock->expects($this->at(0))->method('getStartDate')->will($this->returnValue(new \Datetime($dateInIterator)));
         $iteratorMock->expects($this->at(1))->method('getStartDate')->will($this->returnValue($dateInIterator));
     }
     $this->assertNull($connector->read());
     $connectorData = $context->get(ConnectorInterface::CONTEXT_CONNECTOR_DATA_KEY);
     $this->assertArrayHasKey('lastSyncItemDate', $connectorData);
     if ($hasData) {
         $this->assertSame($expectedDate, $connectorData['lastSyncItemDate']);
     } else {
         $this->assertSame($dateInIterator, $connectorData['lastSyncItemDate']);
     }
 }
开发者ID:antrampa,项目名称:crm,代码行数:43,代码来源:MagentoConnectorTestCase.php

示例3: testGetStatusData

 public function testGetStatusData()
 {
     $connector = $this->getConnector($this->transportMock, $this->stepExecutionMock);
     $connector->setStepExecution($this->stepExecutionMock);
     $reflection = new \ReflectionMethod('\\Oro\\Bundle\\IntegrationBundle\\Tests\\Unit\\Stub\\TestConnector', 'addStatusData');
     $reflection->setAccessible(true);
     $reflection->invoke($connector, 'key', 'value');
     $context = $this->stepExecutionMock->getExecutionContext();
     $date = $context->get(ConnectorInterface::CONTEXT_CONNECTOR_DATA_KEY);
     $this->assertArrayHasKey('key', $date);
     $this->assertSame('value', $date['key']);
     $reflection1 = new \ReflectionMethod('\\Oro\\Bundle\\IntegrationBundle\\Tests\\Unit\\Stub\\TestConnector', 'getStatusData');
     $reflection1->setAccessible(true);
     $result = $reflection1->invoke($connector, 'key', 'value');
     $this->assertSame('value', $result);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:AbstractConnectorTest.php

示例4: getValue

 /**
  * {@inheritdoc}
  */
 public function getValue($name)
 {
     return $this->stepExecution->getExecutionContext()->get($name);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:7,代码来源:StepExecutionProxyContext.php

示例5: getExecutionContext

 /**
  * {@inheritDoc}
  */
 public function getExecutionContext()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getExecutionContext', array());
     return parent::getExecutionContext();
 }
开发者ID:aml-bendall,项目名称:ExpandAkeneoApi,代码行数:8,代码来源:__CG__AkeneoBundleBatchBundleEntityStepExecution.php


注:本文中的Akeneo\Bundle\BatchBundle\Entity\StepExecution::getExecutionContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。