1
1
<?php
2
-
2
+ /**
3
+ * Copyright © 2013-2017 Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
3
6
namespace Magento \Sitemap \Model ;
4
7
5
8
use Magento \Framework \App \CacheInterface ;
6
9
use Magento \TestFramework \Helper \Bootstrap ;
7
10
use Magento \Framework \App \Filesystem ;
8
11
9
12
/**
10
- * Tests Magento\Framework\ComposerInformation
13
+ * Tests class for Magento\Sitemap\Model\Sitemap.
14
+ *
11
15
*/
12
16
class SitemapTest extends \PHPUnit_Framework_TestCase
13
17
{
14
18
/**
15
- * @var \Magento\Framework\ObjectManagerInterface
19
+ * @var \Magento\Framework\ObjectManagerInterface.
16
20
*/
17
21
private $ objectManager ;
18
22
19
23
/**
20
- * @var \Magento\Sitemap\Model\Sitemap
24
+ * @var \Magento\Sitemap\Model\Sitemap.
21
25
*/
22
26
private $ sitemap ;
23
27
24
28
/**
25
- * Remove cached configuration and reinitialize the application
29
+ * Remove cached configuration and reinitialize the application.
26
30
*/
27
31
private function refreshConfiguration ()
28
32
{
@@ -41,14 +45,13 @@ public function setUp()
41
45
}
42
46
43
47
/**
44
- * Test generation sitemap when secure url is on
48
+ * Test generating sitemap.xml file when secure url option is on.
45
49
*
46
50
* @magentoDataFixture Magento/Sitemap/_files/sitemap_secure.php
47
51
*/
48
52
public function testGenerationWithAdminSecureUrl ()
49
53
{
50
54
self ::refreshConfiguration ();
51
-
52
55
$ this ->sitemap ->setData (
53
56
[
54
57
'sitemap_id ' => '1 ' ,
@@ -57,15 +60,11 @@ public function testGenerationWithAdminSecureUrl()
57
60
'store_id ' => '1 '
58
61
]
59
62
);
60
-
61
63
$ result = $ this ->sitemap ->generateXml ();
62
-
63
64
$ filename = BP . $ result ->getSitemapPath () . $ result ->getSitemapFilename ();
64
65
65
66
$ this ->assertFileExists ($ filename , 'File not exists! ' . $ filename );
66
-
67
67
$ file = $ this ->objectManager ->get (\Magento \Framework \Filesystem \Io \File::class);
68
-
69
68
$ file_content = $ file ->read ($ filename );
70
69
71
70
$ this ->assertNotContains ('https ' , $ file_content , "File must not contain https in sitemap file! " );
0 commit comments