-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-33080: Preferences, Shared Instance creation and Compiled Fac…
…tory optimization - shared instances are passed by reference - compiled factory is using shared instances directly
- Loading branch information
1 parent
3318028
commit 33ebc24
Showing
18 changed files
with
389 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...sts/unit/testsuite/Magento/Framework/ObjectManager/Environment/_files/CompiledTesting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
|
||
namespace Magento\Framework\ObjectManager\Environment; | ||
|
||
require 'ConfigTesting.php'; | ||
|
||
class CompiledTesting extends Compiled | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
protected function getConfigData() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* @return \Magento\Framework\Interception\ObjectManager\ConfigInterface | ||
*/ | ||
public function getDiConfig() | ||
{ | ||
return new ConfigTesting(); | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
...tests/unit/testsuite/Magento/Framework/ObjectManager/Environment/_files/ConfigTesting.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
|
||
namespace Magento\Framework\ObjectManager\Environment; | ||
|
||
use Magento\Framework\Interception\ObjectManager\ConfigInterface; | ||
use Magento\Framework\ObjectManager\ConfigCacheInterface; | ||
use Magento\Framework\ObjectManager\RelationsInterface; | ||
|
||
class ConfigTesting implements ConfigInterface | ||
{ | ||
|
||
/** | ||
* Set class relations | ||
* | ||
* @param RelationsInterface $relations | ||
* | ||
* @return void | ||
*/ | ||
public function setRelations(RelationsInterface $relations) | ||
{ | ||
return; | ||
} | ||
|
||
/** | ||
* Set configuration cache instance | ||
* | ||
* @param ConfigCacheInterface $cache | ||
* | ||
* @return void | ||
*/ | ||
public function setCache(ConfigCacheInterface $cache) | ||
{ | ||
return; | ||
} | ||
|
||
/** | ||
* Retrieve list of arguments per type | ||
* | ||
* @param string $type | ||
* @return array | ||
*/ | ||
public function getArguments($type) | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Check whether type is shared | ||
* | ||
* @param string $type | ||
* @return bool | ||
*/ | ||
public function isShared($type) | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Retrieve instance type | ||
* | ||
* @param string $instanceName | ||
* @return mixed | ||
*/ | ||
public function getInstanceType($instanceName) | ||
{ | ||
return $instanceName; | ||
} | ||
|
||
/** | ||
* Retrieve preference for type | ||
* | ||
* @param string $type | ||
* @return string | ||
* @throws \LogicException | ||
*/ | ||
public function getPreference($type) | ||
{ | ||
return $type; | ||
} | ||
|
||
/** | ||
* Returns list of virtual types | ||
* | ||
* @return array | ||
*/ | ||
public function getVirtualTypes() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Extend configuration | ||
* | ||
* @param array $configuration | ||
* @return void | ||
*/ | ||
public function extend(array $configuration) | ||
{ | ||
return; | ||
} | ||
|
||
/** | ||
* Returns list on preferences | ||
* | ||
* @return array | ||
*/ | ||
public function getPreferences() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Set Interception config | ||
* | ||
* @param \Magento\Framework\Interception\ConfigInterface $interceptionConfig | ||
* @return void | ||
*/ | ||
public function setInterceptionConfig(\Magento\Framework\Interception\ConfigInterface $interceptionConfig) | ||
{ | ||
return; | ||
} | ||
|
||
/** | ||
* Retrieve instance type without interception processing | ||
* | ||
* @param string $instanceName | ||
* @return string | ||
*/ | ||
public function getOriginalInstanceType($instanceName) | ||
{ | ||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.