Skip to content

Commit

Permalink
Merge pull request #565 from magento-extensibility/MAGETWO-41996-merc…
Browse files Browse the repository at this point in the history
…hant-beta

[Extensibility] MAGETWO-41996: [GitHub] DI compilation fails on class keyword #1722, MAGETWO-41792: Multiple stores at different paths rendering wrong store base_url
  • Loading branch information
He, Joan(johe) committed Aug 29, 2015
2 parents 18b6326 + 1965343 commit d471820
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 226 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/Directory/Test/Unit/Block/CurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->urlBuilder = $this->getMock(
'\Magento\Framework\UrlInterface\Proxy',
['getUrl'],
'\Magento\Framework\UrlInterface',
[],
[],
'',
false
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Store/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<arguments>
<argument name="session" xsi:type="object" shared="false">Magento\Framework\Session\Generic\Proxy</argument>
<argument name="isCustomEntryPoint" xsi:type="init_parameter">Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM</argument>
<argument name="url" xsi:type="object" shared="false">Magento\Framework\UrlInterface\Proxy</argument>
<argument name="url" xsi:type="object" shared="false">Magento\Framework\UrlInterface</argument>
</arguments>
</type>
<type name="Magento\Store\Model\StoreManager">
Expand Down Expand Up @@ -249,7 +249,7 @@
</type>
<type name="Magento\Framework\App\Helper\Context">
<arguments>
<argument name="urlBuilder" xsi:type="object">Magento\Framework\UrlInterface\Proxy</argument>
<argument name="urlBuilder" xsi:type="object">Magento\Framework\UrlInterface</argument>
<argument name="httpRequest" xsi:type="object">Magento\Framework\App\Request\Http\Proxy</argument>
</arguments>
</type>
Expand Down
5 changes: 2 additions & 3 deletions app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Magento\Framework\App\Helper\Context;
use Magento\Framework\Data\Helper\PostHelper;
use Magento\Framework\Registry;
use Magento\Framework\UrlInterface\Proxy as UrlInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Wishlist\Controller\WishlistProviderInterface;
Expand Down Expand Up @@ -69,9 +69,8 @@ public function setUp()
->method('getStore')
->willReturn($this->store);

$this->urlBuilder = $this->getMockBuilder('Magento\Framework\UrlInterface\Proxy')
$this->urlBuilder = $this->getMockBuilder('Magento\Framework\UrlInterface')
->disableOriginalConstructor()
->setMethods(['getUrl'])
->getMock();

$this->context = $this->getMockBuilder('Magento\Framework\App\Helper\Context')
Expand Down
2 changes: 1 addition & 1 deletion app/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@
</type>
<type name="Magento\Framework\Url\Decoder">
<arguments>
<argument name="urlBuilder" xsi:type="object">Magento\Framework\UrlInterface\Proxy</argument>
<argument name="urlBuilder" xsi:type="object">Magento\Framework\UrlInterface</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/M
setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Helper/Test.php
setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Element.php
setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/ElementFactory.php
setup/src/Magento/Setup/Test/Unit/Module/Di/_files/app/code/Magento/SomeModule/Model/DoubleColon.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ Model3
\Magento\Mtf\Client\Element
\Magento\Mtf\TestSuite\AppState
\Magento\Framework\A
\Magento\Framework\B
\Magento\Framework\B
DoubleColon
212 changes: 0 additions & 212 deletions lib/internal/Magento/Framework/UrlInterface/Proxy.php

This file was deleted.

8 changes: 4 additions & 4 deletions setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@ protected function _fetchClasses($namespace, $tokenIterator, $count, $tokens)
protected function _getDeclaredClasses($file)
{
$classes = [];
$namespace = "";
$namespace = '';
$tokens = token_get_all(file_get_contents($file));
$count = count($tokens);

for ($tokenIterator = 0; $tokenIterator < $count; $tokenIterator++) {
if ($tokens[$tokenIterator][0] === T_NAMESPACE) {
if ($tokens[$tokenIterator][0] == T_NAMESPACE) {
$namespace .= $this->_fetchNamespace($tokenIterator, $count, $tokens);
}

if ($tokens[$tokenIterator][0] === T_CLASS
|| $tokens[$tokenIterator][0] === T_INTERFACE
if (($tokens[$tokenIterator][0] == T_CLASS || $tokens[$tokenIterator][0] == T_INTERFACE)
&& $tokens[$tokenIterator - 1][0] != T_DOUBLE_COLON
) {
$classes = array_merge($classes, $this->_fetchClasses($namespace, $tokenIterator, $count, $tokens));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php';
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php';
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/DoubleColon.php';

class PhpScannerTest extends \PHPUnit_Framework_TestCase
{
/**
Expand Down Expand Up @@ -35,7 +37,10 @@ protected function setUp()
$this->_logMock = $this->getMock('\Magento\Setup\Module\Di\Compiler\Log\Log', [], [], '', false)
);
$this->_testDir = str_replace('\\', '/', realpath(__DIR__ . '/../../') . '/_files');
$this->_testFiles = [$this->_testDir . '/app/code/Magento/SomeModule/Helper/Test.php'];
$this->_testFiles = [
$this->_testDir . '/app/code/Magento/SomeModule/Helper/Test.php',
$this->_testDir . '/app/code/Magento/SomeModule/Model/DoubleColon.php'
];
}

public function testCollectEntities()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\SomeModule\Model;

class DoubleColon
{
public function __construct()
{
DoubleColon::class;
}

public function method()
{
}
}

0 comments on commit d471820

Please sign in to comment.