Skip to content

Instantly share code, notes, and snippets.

@piotrekkaminski
Created June 8, 2015 21:54
Show Gist options
  • Save piotrekkaminski/755f3f1ca2c1b7cafc23 to your computer and use it in GitHub Desktop.
Save piotrekkaminski/755f3f1ca2c1b7cafc23 to your computer and use it in GitHub Desktop.
website.patch
Index: dev/tests/functional/tests/app/Mage/Adminhtml/Test/Constraint/AssertProductIsPresentOnCustomWebsite.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- dev/tests/functional/tests/app/Mage/Adminhtml/Test/Constraint/AssertProductIsPresentOnCustomWebsite.php (revision 133010710c8351e2bc0f3d64631a99633732a7c1)
+++ dev/tests/functional/tests/app/Mage/Adminhtml/Test/Constraint/AssertProductIsPresentOnCustomWebsite.php (revision )
@@ -34,7 +34,6 @@
use Magento\Mtf\Fixture\FixtureFactory;
use Magento\Mtf\Fixture\InjectableFixture;
use Magento\Mtf\Constraint\AbstractConstraint;
-use Mage\CatalogSearch\Test\Page\CatalogsearchResult;
/**
* Assert that product is present on custom website.
@@ -62,13 +61,6 @@
*/
protected $websiteFolder;
- /**
- * Base dir path.
- *
- * @var string
- */
- protected $baseDir;
-
/* tags */
const SEVERITY = 'low';
/* end tags */
@@ -120,16 +112,9 @@
protected function setupPaths()
{
$code = $this->website->getCode();
- if (isset($_ENV['basedir'])) {
- $this->baseDir = $_ENV['basedir'];
- $this->magentoRoot = isset($_ENV['product_root_dir'])
- ? $_ENV['product_root_dir'] . DIRECTORY_SEPARATOR . $_ENV['instance']
- : $_ENV['basedir'];
+ $this->magentoRoot = realpath(MTF_BP . '../../../../');
- $this->websiteFolder = $this->magentoRoot . DIRECTORY_SEPARATOR . "websites" . DIRECTORY_SEPARATOR . $code;
+ $this->websiteFolder = $this->magentoRoot . DIRECTORY_SEPARATOR . "websites" . DIRECTORY_SEPARATOR . $code;
- } else {
- throw new \Exception("\$_ENV['basedir'] variable should be set in phpunit.xml.");
- }
+ }
- }
/**
* Create Website folder in magento root.
@@ -138,13 +123,13 @@
*/
protected function createWebsiteFolder()
{
- $oldmask = umask(0);
+ $oldMask = umask(0);
if (!is_dir($this->magentoRoot . DIRECTORY_SEPARATOR . 'websites')) {
mkdir($this->magentoRoot . DIRECTORY_SEPARATOR . 'websites', 0777);
}
mkdir($this->websiteFolder, 0777);
- umask($oldmask);
+ umask($oldMask);
}
/**
@@ -154,9 +139,9 @@
*/
protected function placeFiles()
{
- $htaccessFile = file_get_contents($this->baseDir . DIRECTORY_SEPARATOR .'.htaccess');
+ $htaccessFile = file_get_contents($this->magentoRoot . DIRECTORY_SEPARATOR .'.htaccess');
file_put_contents($this->websiteFolder . DIRECTORY_SEPARATOR . ".htaccess", $htaccessFile);
- $indexPhpFile = file_get_contents($this->baseDir . DIRECTORY_SEPARATOR . 'index.php');
+ $indexPhpFile = file_get_contents($this->magentoRoot . DIRECTORY_SEPARATOR . 'index.php');
$replace = ["getcwd()", "(\$mageRunCode, \$mageRunType)"];
$replacement = ["'{$this->magentoRoot}'", "('{$this->website->getCode()}', 'website')"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment