File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
dev/tests/integration/testsuite/Magento
UrlRewrite/Block/Catalog/Category Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ /** @var $category \Magento\Catalog\Model\Category */
8
+ $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
9
+
10
+ $ categoryFirst = $ objectManager ->create (\Magento \Catalog \Model \Category::class);
11
+ $ categoryFirst ->setName ('Category 1 ' )
12
+ ->setPath ('1/2 ' )
13
+ ->setLevel (2 )
14
+ ->setAvailableSortBy ('name ' )
15
+ ->setDefaultSortBy ('name ' )
16
+ ->setIsActive (true )
17
+ ->setPosition (1 )
18
+ ->save ();
19
+
20
+ // products from this fixture were moved to indexer_catalog_products.php
21
+ $ categorySecond = $ objectManager ->create (\Magento \Catalog \Model \Category::class);
22
+ $ categorySecond ->setName ('"Category 6" ' )
23
+ ->setPath ($ categoryFirst ->getPath ())
24
+ ->setLevel (3 )
25
+ ->setAvailableSortBy ('name ' )
26
+ ->setDefaultSortBy ('name ' )
27
+ ->setIsActive (true )
28
+ ->setPosition (1 )
29
+ ->save ();
Original file line number Diff line number Diff line change @@ -58,7 +58,24 @@ public function testGetTreeArrayApostropheReplaced()
58
58
59
59
$ this ->assertNotContains ('\'' , $ tree ['children ' ][0 ]['children ' ][0 ]['children ' ][0 ]['name ' ]);
60
60
$ this ->assertEquals (
61
- '&#039;Category 6&#039; ' ,
61
+ ''Category 6' ' ,
62
+ $ tree ['children ' ][0 ]['children ' ][0 ]['children ' ][0 ]['name ' ]
63
+ );
64
+ }
65
+
66
+ /**
67
+ * Test that the getTreeArray() method scrubs single quotes and apostrophes from names
68
+ *
69
+ * @magentoAppIsolation enabled
70
+ * @magentoDataFixture Magento/Catalog/_files/catalog_category_with_doublequotes.php
71
+ */
72
+ public function testGetTreeArrayDoubleQuotesReplaced ()
73
+ {
74
+ $ tree = $ this ->_treeBlock ->getTreeArray ();
75
+
76
+ $ this ->assertNotContains ('\'' , $ tree ['children ' ][0 ]['children ' ][0 ]['children ' ][0 ]['name ' ]);
77
+ $ this ->assertEquals (
78
+ '&quot;Category 6&quot; ' ,
62
79
$ tree ['children ' ][0 ]['children ' ][0 ]['children ' ][0 ]['name ' ]
63
80
);
64
81
}
You can’t perform that action at this time.
0 commit comments