當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。