This repository has been archived by the owner on Jun 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
49 additions
and
1 deletion.
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
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
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
* Test if Inchoo_PHP is installed and integrated into Magento correctly. | ||
* | ||
* TODO: check PHP version vs Mcrypt. Sugest Mcrypt polyfill on PHP 7.1 | ||
* IDEA: for testing core overwrites - implement a const in those classes, so we can check for its existence | ||
* | ||
* @author Ivan Čurdinjaković <[email protected]> | ||
*/ | ||
|
@@ -45,6 +44,16 @@ private function checkRewrite($model, string $className): bool | |
return (get_class($model) === $className || get_parent_class($model) === $className); | ||
} | ||
|
||
/** | ||
* Checks if a class has INCHOO_PHP7 const, proving it is correctly overriden | ||
* @param string $class | ||
* @return bool | ||
*/ | ||
private function checkOverride(string $class): bool | ||
{ | ||
return defined("$class::INCHOO_PHP7"); | ||
} | ||
|
||
private function isCoreHelperRewritten(): bool | ||
{ | ||
return $this->checkRewrite($this->coreHelper, 'Inchoo_PHP7_Helper_Data'); | ||
|
@@ -95,6 +104,21 @@ private function isExportEntityCustomerRewritten(): bool | |
); | ||
} | ||
|
||
private function isPackagerOverriden(): bool | ||
{ | ||
return $this->checkOverride('Mage_Connect_Packager'); | ||
} | ||
|
||
private function isUploaderOverriden(): bool | ||
{ | ||
return $this->checkOverride('Mage_Core_Model_File_Uploader'); | ||
} | ||
|
||
private function isSessionOverriden(): bool | ||
{ | ||
return $this->checkOverride('Mage_Core_Model_Resource_Session'); | ||
} | ||
|
||
/** | ||
* Check if extension version is appropriate for M core | ||
* @return int Extension major version: 1 or 2 | ||
|
@@ -212,6 +236,22 @@ public function run() | |
); | ||
$extensionVersion = $this->checkExtensionAndCoreVersions(); | ||
|
||
$this->doTest( | ||
[$this, 'isPackagerOverriden'], | ||
'Magento Connect Packager is overriden.', | ||
'Magento Connect Packager override PROBLEM!' | ||
); | ||
$this->doTest( | ||
[$this, 'isUploaderOverriden'], | ||
'Magento File Uploader is overriden.', | ||
'Magento File Uploader override PROBLEM!' | ||
); | ||
$this->doTest( | ||
[$this, 'isSessionOverriden'], | ||
'Magento Session Resource is overriden.', | ||
'Magento File Uploader override PROBLEM!' | ||
); | ||
|
||
// Inchoo_PHP7 1.* specific tests | ||
if ($extensionVersion === 1) { | ||
$this->doTest( | ||
|