-
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.
Merge pull request #5069 from magento-tsg-csl3/2.3-develop-pr38
TSG-CSL3 For 2.3-develop (pr38)
- Loading branch information
Showing
8 changed files
with
243 additions
and
22 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
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
70 changes: 70 additions & 0 deletions
70
dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapTest.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,70 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Sitemap\Model; | ||
|
||
use Magento\Framework\App\Filesystem\DirectoryList; | ||
use Magento\Framework\Filesystem; | ||
use Magento\Framework\ObjectManagerInterface; | ||
use Magento\Sitemap\Model\Sitemap; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use Magento\TestFramework\Request; | ||
use Zend\Stdlib\Parameters; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Tests \Magento\Sitemap\Model\Sitemap functionality. | ||
*/ | ||
class SitemapTest extends TestCase | ||
{ | ||
/** | ||
* @var Sitemap | ||
*/ | ||
private $model; | ||
|
||
/** | ||
* @var ObjectManagerInterface | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var Filesystem | ||
*/ | ||
private $filesystem; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->objectManager = Bootstrap::getObjectManager(); | ||
$this->model = $this->objectManager->get(Sitemap::class); | ||
$this->filesystem = $this->objectManager->get(Filesystem::class); | ||
} | ||
|
||
/** | ||
* Test get sitemap URL from parent root directory path | ||
* | ||
* @return void | ||
*/ | ||
public function testGetSitemapUrlFromParentRootDirectoryPath(): void | ||
{ | ||
$rootDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT) | ||
->getAbsolutePath(); | ||
$requestPath = dirname($rootDir); | ||
|
||
/** @var Request $request */ | ||
$request = $this->objectManager->get(Request::class); | ||
//imitation run script from parent root directory | ||
$request->setServer(new Parameters(['DOCUMENT_ROOT' => $requestPath])); | ||
|
||
$sitemapUrl = $this->model->getSitemapUrl('/', 'sitemap.xml'); | ||
|
||
$this->assertEquals('http://localhost/sitemap.xml', $sitemapUrl); | ||
} | ||
} |