Skip to content

Commit

Permalink
Compat 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Jul 29, 2020
1 parent b196637 commit 15a1123
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .module.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EXTENSION_VENDOR="Yireo"
EXTENSION_NAME="CommonViewModels"
COMPOSER_NAME="yireo/magento2-common-view-models"
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.2] - 29 July 2020
### Added
- Magento 2.4 compatibility

## [0.0.1] - Undocumented
18 changes: 13 additions & 5 deletions Test/Integration/ViewModel/CurrentProductTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);

namespace Yireo\CommonViewModels\Test\Integration;

use Magento\Framework\App\RequestInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\HTTP\PhpEnvironment\Request;
use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
Expand All @@ -18,28 +20,34 @@
*/
class CurrentProductTest extends AbstractControllerTestCase
{
/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @throws NoSuchEntityException
*/
public function testIfCheckOfRightPageFails()
{
$this->expectException(\RuntimeException::class);
$productId = 1;

/** @var CurrentProduct $viewModel */
$viewModel = Bootstrap::getObjectManager()->get(CurrentProduct::class);
$viewModel->initialize();
$product = $viewModel->getProduct();
$this->assertEquals($productId, $product->getId());
}

/**
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @throws NoSuchEntityException
*/
public function testIfTheRightPageWorks()
{
$productId = 1;

/** @var Request $request */
//$request = Bootstrap::getObjectManager()->get(RequestInterface::class);
//$request->setActionName('view');
//$request->setControllerName('product');
//$request->setParams(['id' => $productId]);
$this->dispatch('catalog/product/view/id/'.$productId);
$this->dispatch('catalog/product/view/id/' . $productId);

/** @var CurrentProduct $viewModel */
$viewModel = Bootstrap::getObjectManager()->get(CurrentProduct::class);
$viewModel->initialize();
$product = $viewModel->getProduct();
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yireo/magento2-common-view-models",
"type": "magento2-module",
"version": "0.0.1",
"version": "0.0.2",
"license": "OSL-3.0",
"description": "",
"keywords": [
Expand All @@ -15,9 +15,9 @@
}
],
"require": {
"magento/module-catalog": "^102.0|^103.0",
"magento/framework": "^102.0",
"php": ">=7.0.0"
"magento/module-catalog": "^102.0|^103.0|^104.0",
"magento/framework": "^102.0|^103.0",
"php": ">=7.2.0"
},
"require-dev": {
"phpunit/phpunit": "*",
Expand All @@ -31,4 +31,4 @@
"registration.php"
]
}
}
}

0 comments on commit 15a1123

Please sign in to comment.