Ejemplo n.º 1
0
 public function testLoadActiveIntegrationByConsumerId()
 {
     $consumerId = 1;
     $integrationData = ['integration_id' => 1, 'name' => 'Test Integration'];
     $this->resourceMock->expects($this->once())->method('selectActiveIntegrationByConsumerId')->with($consumerId)->will($this->returnValue($integrationData));
     $this->integrationModel->loadActiveIntegrationByConsumerId($consumerId);
     $this->assertEquals($integrationData, $this->integrationModel->getData());
 }
Ejemplo n.º 2
0
 public function testLoadByCompositeKey()
 {
     $expectedData = ['testData'];
     $nonce = 'testNonce';
     $consumerId = 1;
     $this->resourceMock->expects($this->once())->method('selectByCompositeKey')->with($nonce, $consumerId)->will($this->returnValue($expectedData));
     $this->nonceModel->loadByCompositeKey($nonce, $consumerId);
     $this->assertEquals($expectedData, $this->nonceModel->getData());
 }
Ejemplo n.º 3
0
 /**
  * @test
  * @return void
  * @covers \Magento\Theme\Model\Design::loadChange
  */
 public function testLoadChange()
 {
     $storeId = 1;
     $localDate = '2\\28\\2000';
     $date = '28-02-2000';
     $cacheId = 'design_change_' . md5($storeId . $date);
     $this->localeDate->expects($this->once())->method('scopeTimeStamp')->with($storeId)->willReturn($localDate);
     $this->dateTime->expects($this->once())->method('formatDate')->with($localDate, false)->willReturn($date);
     $this->cacheManager->expects($this->once())->method('load')->with($cacheId)->willReturn(false);
     $this->resource->expects($this->once())->method('loadChange')->with($storeId, $date)->willReturn(false);
     $this->cacheManager->expects($this->once())->method('save')->with(serialize([]), $cacheId, [Design::CACHE_TAG], 86400)->willReturnSelf();
     $this->assertInstanceOf(get_class($this->model), $this->model->loadChange($storeId));
 }
Ejemplo n.º 4
0
 public function testLoad()
 {
     $token = 'testToken';
     $this->resourceMock->expects($this->once())->method('load');
     $actualToken = $this->tokenModel->loadByToken($token);
     $this->assertEquals($this->tokenModel, $actualToken);
 }
Ejemplo n.º 5
0
 public function testGetSearchableData()
 {
     $productId = 15;
     $storeId = 1;
     $data = 'data';
     $this->resource->expects($this->any())->method('getSearchableData')->with($productId, $storeId)->will($this->returnValue($data));
     $this->assertEquals($data, $this->model->getSearchableData($productId, $storeId));
 }
Ejemplo n.º 6
0
 public function testSaveProductRelations()
 {
     $data = [1];
     $typeId = 1;
     $this->model->setData('link_type_id', $typeId);
     $product = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['getRelatedLinkData', 'getUpSellLinkData', 'getCrossSellLinkData', '__wakeup'])->getMock();
     $product->expects($this->any())->method('getRelatedLinkData')->will($this->returnValue($data));
     $product->expects($this->any())->method('getUpSellLinkData')->will($this->returnValue($data));
     $product->expects($this->any())->method('getCrossSellLinkData')->will($this->returnValue($data));
     $map = [[$product, $data, Link::LINK_TYPE_RELATED, $this->resource], [$product, $data, Link::LINK_TYPE_UPSELL, $this->resource], [$product, $data, Link::LINK_TYPE_CROSSSELL, $this->resource]];
     $this->resource->expects($this->any())->method('saveProductLinks')->will($this->returnValueMap($map));
     $this->model->saveProductRelations($product);
 }
Ejemplo n.º 7
0
 public function testGetConsumerExpirationPeriodExpired()
 {
     $this->resourceMock->expects($this->once())->method('getTimeInSecondsSinceCreation')->will($this->returnValue(400));
     $this->consumerModel->setCreatedAt(time());
     $this->assertFalse($this->consumerModel->isValidForTokenExchange());
 }