Skip to content

Commit

Permalink
Merge pull request #448 from magento-ogre/PR_Branch
Browse files Browse the repository at this point in the history
[Ogre's] Public PRs and Bugs
  • Loading branch information
Melnikov, Igor(imelnikov) committed Mar 18, 2016
2 parents aad945c + 4ea0299 commit ac52fe3
Show file tree
Hide file tree
Showing 820 changed files with 3,174 additions and 1,020 deletions.
13 changes: 5 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ env:
- TEST_SUITE=integration_part_1
- TEST_SUITE=integration_part_2
- TEST_SUITE=integration_integrity
- TEST_SUITE=static_phpcs
- TEST_SUITE=static_annotation
- TEST_SUITE=static
cache:
apt: true
directories:
Expand All @@ -21,9 +20,9 @@ cache:
matrix:
exclude:
- php: 5.6
env: TEST_SUITE=static_phpcs
- php: 5.6
env: TEST_SUITE=static_annotation
env: TEST_SUITE=static
- php: 7.0
env: TEST_SUITE=static
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq postfix
Expand Down Expand Up @@ -68,6 +67,4 @@ script:
# Integration integrity tests
- sh -c "if [ '$TEST_SUITE' = 'integration_integrity' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.dist testsuite/Magento/Test/Integrity; fi"
# Static tests [Code Style]
- sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testCodeStyle'; fi"
# Static tests [Code Style]
- sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi"
- sh -c "if [ '$TEST_SUITE' = 'static' ]; then cd dev/tests/static/; php get_github_changes.php --output-file='$TRAVIS_BUILD_DIR/dev/tests/static/testsuite/Magento/Test/_files/changed_files_ce.txt' --base-path='$TRAVIS_BUILD_DIR' --repo='https://github.com/magento/magento2.git' --branch='develop'; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest'; fi"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=master)](https://travis-ci.org/magento/magento2)
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=develop)](https://travis-ci.org/magento/magento2)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
<h2>Welcome</h2>
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class TierPriceTest extends \PHPUnit_Framework_TestCase
*/
protected $tierPrice;


public function setUp()
protected function setUp()
{
$this->groupRepository = $this->getMockBuilder('\Magento\Customer\Api\GroupRepositoryInterface')
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
*/
protected $website;

public function setUp()
protected function setUp()
{
$this->webSiteModel = $this->getMock(
'\Magento\Store\Model\WebSite',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase
*/
protected $validatorTest;

public function setUp()
protected function setUp()
{
$this->validatorTest = $this->getMockForAbstractClass(
'Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class AdvancedPricingTest extends \Magento\ImportExport\Test\Unit\Model\Import\A
*/
protected $errorAggregator;

public function setUp()
protected function setUp()
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase
*/
protected $advancedPricing;

public function setUp()
protected function setUp()
{
$this->indexer = $this->getMockForAbstractClass('\Magento\Framework\Indexer\IndexerInterface', [], '', false);
$this->import = $this->getMock(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PlaceTest extends \PHPUnit_Framework_TestCase
* @var ObjectManager
*/
protected $objectManager;

/**
* @var Place
*/
Expand Down Expand Up @@ -98,7 +99,7 @@ class PlaceTest extends \PHPUnit_Framework_TestCase
*/
protected $checkoutSessionMock;

public function setUp()
protected function setUp()
{
$this->directpostSessionMock = $this
->getMockBuilder('Magento\Authorizenet\Model\Directpost\Session')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase
*/
protected $storageMock;

public function setUp()
protected function setUp()
{
$this->storageMock = $this
->getMockBuilder('Magento\Framework\Session\StorageInterface')
Expand Down
11 changes: 10 additions & 1 deletion app/code/Magento/Backend/Model/Auth/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,16 @@ public function isLoggedIn()
*/
public function prolong()
{
$this->setUpdatedAt(time());
$cookieValue = $this->cookieManager->getCookie($this->getName());
if ($cookieValue) {
$this->setUpdatedAt(time());
$cookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()
->setPath($this->sessionConfig->getCookiePath())
->setDomain($this->sessionConfig->getCookieDomain())
->setSecure($this->sessionConfig->getCookieSecure())
->setHttpOnly($this->sessionConfig->getCookieHttpOnly());
$this->cookieManager->setPublicCookie($this->getName(), $cookieValue, $cookieMetadata);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ class ConcatTest extends \PHPUnit_Framework_TestCase
{
/** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */
protected $objectManagerHelper;

/** @var \Magento\Backend\Block\Widget\Grid\Column\Renderer\Concat */
protected $renderer;

public function setUp()
protected function setUp()
{
$this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->renderer = $this->objectManagerHelper->getObject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class AbstractCacheCommandTest extends \PHPUnit_Framework_TestCase
*/
protected $command;

public function setUp()
protected function setUp()
{
$this->cacheManagerMock = $this->getMock('Magento\Framework\App\Cache\Manager', [], [], '', false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class AbstractCacheManageCommandTest extends AbstractCacheCommandTest
/** @var \Magento\Framework\Event\ManagerInterface | \PHPUnit_Framework_MockObject_MockObject */
protected $eventManagerMock;

public function setUp()
protected function setUp()
{
$this->eventManagerMock = $this->getMockBuilder('\Magento\Framework\Event\ManagerInterface')
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CacheCleanCommandTest extends AbstractCacheManageCommandTest
{
public function setUp()
protected function setUp()
{
$this->cacheEventName = 'adminhtml_cache_flush_system';
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CacheDisableCommandTest extends AbstractCacheSetCommandTest
{
public function setUp()
protected function setUp()
{
parent::setUp();
$this->command = new CacheDisableCommand($this->cacheManagerMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CacheEnableCommandTest extends AbstractCacheSetCommandTest
{
public function setUp()
protected function setUp()
{
parent::setUp();
$this->command = new CacheEnableCommand($this->cacheManagerMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CacheFlushCommandTest extends AbstractCacheManageCommandTest
{
public function setUp()
protected function setUp()
{
$this->cacheEventName = 'adminhtml_cache_flush_all';
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CacheStatusCommandTest extends AbstractCacheCommandTest
{
public function setUp()
protected function setUp()
{
parent::setUp();
$this->command = new CacheStatusCommand($this->cacheManagerMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class RefreshStatisticsTest extends \PHPUnit_Framework_TestCase
*/
protected $context;

public function setUp()
protected function setUp()
{
$reportTypes = [
'sales' => 'Magento\Sales\Model\ResourceModel\Report\Order'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AdminPathConfigTest extends \PHPUnit_Framework_TestCase
*/
protected $adminPathConfig;

public function setUp()
protected function setUp()
{
$this->coreConfig = $this->getMockForAbstractClass(
'Magento\Framework\App\Config\ScopeConfigInterface',
Expand Down
51 changes: 51 additions & 0 deletions app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,58 @@ public function testIsLoggedInPositive()

public function testProlong()
{
$name = session_name();
$cookie = 'cookie';
$path = '/';
$domain = 'magento2';
$secure = true;
$httpOnly = true;

$cookieMetadata = $this->getMock('Magento\Framework\Stdlib\Cookie\PublicCookieMetadata');
$cookieMetadata->expects($this->once())
->method('setPath')
->with($path)
->will($this->returnSelf());
$cookieMetadata->expects($this->once())
->method('setDomain')
->with($domain)
->will($this->returnSelf());
$cookieMetadata->expects($this->once())
->method('setSecure')
->with($secure)
->will($this->returnSelf());
$cookieMetadata->expects($this->once())
->method('setHttpOnly')
->with($httpOnly)
->will($this->returnSelf());

$this->cookieMetadataFactory->expects($this->once())
->method('createPublicCookieMetadata')
->will($this->returnValue($cookieMetadata));

$this->cookieManager->expects($this->once())
->method('getCookie')
->with($name)
->will($this->returnValue($cookie));
$this->cookieManager->expects($this->once())
->method('setPublicCookie')
->with($name, $cookie, $cookieMetadata);

$this->sessionConfig->expects($this->once())
->method('getCookiePath')
->will($this->returnValue($path));
$this->sessionConfig->expects($this->once())
->method('getCookieDomain')
->will($this->returnValue($domain));
$this->sessionConfig->expects($this->once())
->method('getCookieSecure')
->will($this->returnValue($secure));
$this->sessionConfig->expects($this->once())
->method('getCookieHttpOnly')
->will($this->returnValue($httpOnly));

$this->session->prolong();

$this->assertLessThanOrEqual(time(), $this->session->getUpdatedAt());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase
*/
protected $resultRedirectMock;

public function setUp()
protected function setUp()
{
$this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
->getMock();
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/Test/Unit/Helper/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
*/
protected $filesystem;

public function setUp()
protected function setUp()
{
$this->filesystem = $this->getMockBuilder('Magento\Framework\Filesystem')->disableOriginalConstructor()
->getMock();
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/Test/Unit/Model/BackupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BackupTest extends \PHPUnit_Framework_TestCase
*/
protected $directoryMock;

public function setUp()
protected function setUp()
{
$this->filesystemMock = $this->getMockBuilder('Magento\Framework\Filesystem')
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TransferFactoryTest extends \PHPUnit_Framework_TestCase
*/
private $transferBuilder;

public function setUp()
protected function setUp()
{
$this->transferBuilder = $this->getMock(TransferBuilder::class);
$this->transferMock = $this->getMock(TransferInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AddressDataBuilderTest extends \PHPUnit_Framework_TestCase
*/
private $subjectReaderMock;

public function setUp()
protected function setUp()
{
$this->paymentDOMock = $this->getMock(PaymentDataObjectInterface::class);
$this->orderMock = $this->getMock(OrderAdapterInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CustomerDataBuilderTest extends \PHPUnit_Framework_TestCase
*/
private $subjectReaderMock;

public function setUp()
protected function setUp()
{
$this->paymentDOMock = $this->getMock(PaymentDataObjectInterface::class);
$this->orderMock = $this->getMock(OrderAdapterInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class KountPaymentDataBuilderTest extends \PHPUnit_Framework_TestCase
*/
private $subjectReaderMock;

public function setUp()
protected function setUp()
{
$this->paymentDO = $this->getMock(PaymentDataObjectInterface::class);
$this->configMock = $this->getMockBuilder(Config::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

/**
* Class PaymentDataBuilderTest
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class PaymentDataBuilderTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -51,7 +53,7 @@ class PaymentDataBuilderTest extends \PHPUnit_Framework_TestCase
*/
private $orderMock;

public function setUp()
protected function setUp()
{
$this->paymentDO = $this->getMock(PaymentDataObjectInterface::class);
$this->configMock = $this->getMockBuilder(Config::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RiskDataHandlerTest extends \PHPUnit_Framework_TestCase
/**
* Set up
*/
public function setUp()
protected function setUp()
{
$this->subjectReaderMock = $this->getMockBuilder(SubjectReader::class)
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CheckboxTest extends \PHPUnit_Framework_TestCase
*/
protected $block;

public function setUp()
protected function setUp()
{
$this->block = (new ObjectManager($this))
->getObject('Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Checkbox');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MultiTest extends \PHPUnit_Framework_TestCase
*/
protected $block;

public function setUp()
protected function setUp()
{
$this->block = (new ObjectManager($this))
->getObject('Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Multi');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class RadioTest extends \PHPUnit_Framework_TestCase
*/
protected $block;

public function setUp()
protected function setUp()
{
$this->block = (new ObjectManager($this))
->getObject('Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Options\Type\Radio');
Expand Down
Loading

0 comments on commit ac52fe3

Please sign in to comment.