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


PHP PHPUnit_Framework_MockObject_MockObject::getId方法代码示例

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


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

示例1: saveModelAndFailOnUpdate

 /**
  * Callback for save method in mocked model
  *
  * @throws Magento_Exception
  */
 public function saveModelAndFailOnUpdate()
 {
     if (!$this->_model->getId()) {
         $this->saveModelSuccessfully();
     } else {
         throw new Magento_Exception('Synthetic model update failure.');
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:13,代码来源:EntityTest.php

示例2: saveModelAndFailOnUpdate

 /**
  * Callback for save method in mocked model
  *
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function saveModelAndFailOnUpdate()
 {
     if (!$this->_model->getId()) {
         $this->saveModelSuccessfully();
     } else {
         throw new \Magento\Framework\Exception\LocalizedException(__('Synthetic model update failure.'));
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:13,代码来源:EntityTest.php

示例3: testSetAndGetId

 public function testSetAndGetId()
 {
     $this->mockModel();
     $testId = 9999;
     $this->model->setId($testId);
     $this->assertEquals($testId, $this->model->getId());
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:7,代码来源:TemplateTest.php

示例4: createSampleModel

 /**
  * @param \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject $product
  * @param array $modelData
  * @return \Magento\Downloadable\Model\Sample|\PHPUnit_Framework_MockObject_MockObject
  */
 private function createSampleModel($product, array $modelData)
 {
     $sample = $this->getMockBuilder('\\Magento\\Downloadable\\Model\\Sample')->disableOriginalConstructor()->setMethods(['setData', 'setSampleType', 'setProductId', 'setStoreId', 'setProductWebsiteIds', 'setNumberOfDownloads', 'setSampleUrl', 'setLinkFile', 'setSampleFile', 'save'])->getMock();
     $sample->expects($this->once())->method('setData')->with($modelData)->will($this->returnSelf());
     $sample->expects($this->once())->method('setSampleType')->with($modelData['type'])->will($this->returnSelf());
     $sample->expects($this->once())->method('setProductId')->with($product->getId())->will($this->returnSelf());
     $sample->expects($this->once())->method('setStoreId')->with($product->getStoreId())->will($this->returnSelf());
     return $sample;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:SampleTest.php

示例5: testGetInfo

 /**
  * @covers ::getInfo
  */
 public function testGetInfo()
 {
     $token_info = array('types' => array('foo' => array('name' => $this->randomMachineName())));
     $this->language->expects($this->atLeastOnce())->method('getId')->will($this->returnValue($this->randomMachineName()));
     $this->languageManager->expects($this->once())->method('getCurrentLanguage')->with(LanguageInterface::TYPE_CONTENT)->will($this->returnValue($this->language));
     // The persistent cache must only be hit once, after which the info is
     // cached statically.
     $this->cache->expects($this->once())->method('get');
     $this->cache->expects($this->once())->method('set')->with('token_info:' . $this->language->getId(), $token_info);
     $this->moduleHandler->expects($this->once())->method('invokeAll')->with('token_info')->will($this->returnValue($token_info));
     $this->moduleHandler->expects($this->once())->method('alter')->with('token_info', $token_info);
     // Get the information for the first time. The cache should be checked, the
     // hooks invoked, and the info should be set to the cache should.
     $this->token->getInfo();
     // Get the information for the second time. The data must be returned from
     // the static cache, so the persistent cache must not be accessed and the
     // hooks must not be invoked.
     $this->token->getInfo();
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:22,代码来源:TokenTest.php

示例6: testExecuteUrlKey

 /**
  * @param bool $isChangedUrlKey
  * @param bool $isChangedVisibility
  * @param bool $isChangedWebsites
  * @param bool $isChangedCategories
  * @param bool $visibilityResult
  * @param int $expectedDeleteCount
  * @param int $expectedReplaceCount
  *
  * @dataProvider testUrlKeyDataProvider
  */
 public function testExecuteUrlKey($isChangedUrlKey, $isChangedVisibility, $isChangedWebsites, $isChangedCategories, $visibilityResult, $expectedDeleteCount, $expectedReplaceCount)
 {
     $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue(12));
     $this->product->expects($this->any())->method('dataHasChangedFor')->will($this->returnValueMap([['visibility', $isChangedVisibility], ['url_key', $isChangedUrlKey]]));
     $this->product->expects($this->any())->method('getIsChangedWebsites')->will($this->returnValue($isChangedWebsites));
     $this->product->expects($this->any())->method('getIsChangedCategories')->will($this->returnValue($isChangedCategories));
     $this->urlPersist->expects($this->exactly($expectedDeleteCount))->method('deleteByData')->with([UrlRewrite::ENTITY_ID => $this->product->getId(), UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, UrlRewrite::REDIRECT_TYPE => 0, UrlRewrite::STORE_ID => $this->product->getStoreId()]);
     $this->product->expects($this->any())->method('isVisibleInSiteVisibility')->will($this->returnValue($visibilityResult));
     $this->urlPersist->expects($this->exactly($expectedReplaceCount))->method('replace')->with([3 => 'rewrite']);
     $this->model->execute($this->observer);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:22,代码来源:ProductProcessUrlRewriteSavingObserverTest.php

示例7: getTitle

 /**
  * @return \Magento\Framework\Phrase|string
  */
 protected function getTitle()
 {
     return $this->blockMock->getId() ? $this->blockMock->getTitle() : __('New Block');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:EditTest.php

示例8: testSendTransactional

 public function testSendTransactional()
 {
     $this->_model->sendTransactional('customer_create_account_email_template', array('name' => 'Sender Name', 'email' => 'sender@example.com'), 'recipient@example.com', 'Recipient Name');
     $this->assertEquals('customer_create_account_email_template', $this->_model->getId());
     $this->assertTrue($this->_model->getSentSuccess());
 }
开发者ID:natxetee,项目名称:magento2,代码行数:6,代码来源:TemplateTest.php

示例9: testGetId

 /**
  * Test the getId() method from the Chromosome class
  * 
  * @uses \bcGen\MainBundle\Entity\Chromosome::getId()
  */
 public function testGetId()
 {
     echo "\n********************Test GetId()*********************************************************\n";
     $this->stubedChromosome->method('getId')->willReturn(1);
     $this->assertEquals(1, $this->stubedChromosome->getId());
 }
开发者ID:vaxz,项目名称:bc-genome,代码行数:11,代码来源:ChromosomeTest.php

示例10: testLoad

 /**
  * @param $loadId
  * @param $expectedId
  * @dataProvider loadDataProvider
  */
 public function testLoad($loadId, $expectedId)
 {
     $this->model->load($loadId);
     $this->assertEquals($expectedId, $this->model->getId());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:StoreTest.php

示例11: getTitle

 /**
  * @return \Magento\Framework\Phrase|string
  */
 protected function getTitle()
 {
     return $this->pageMock->getId() ? $this->pageMock->getTitle() : __('New Page');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:EditTest.php

示例12: testEntityMethods

 public function testEntityMethods()
 {
     $this->assertNull($this->entity->getId());
 }
开发者ID:ramunasd,项目名称:platform,代码行数:4,代码来源:TransportTest.php

示例13: testSetId

 /**
  * @param \PHPUnit_Framework_MockObject_MockObject $criteria
  * @return \PHPUnit_Framework_MockObject_MockObject
  *
  * @depends testImplementCriteriaInterface
  * @covers Sellsy\Criteria\Generic\GetOneCriteria::setId
  */
 public function testSetId(\PHPUnit_Framework_MockObject_MockObject $criteria)
 {
     $criteria->setId(12);
     $this->assertEquals(12, $criteria->getId());
     return $criteria;
 }
开发者ID:mehdi-ghezal,项目名称:sellsy-api,代码行数:13,代码来源:GetListOne.php


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