@@ -29,7 +29,7 @@ class ViewTest extends TestCase
29
29
private $ objectManager ;
30
30
31
31
/** @var View */
32
- private $ _block ;
32
+ private $ block ;
33
33
34
34
/** @var ProductRepositoryInterface */
35
35
private $ productRepository ;
@@ -49,7 +49,7 @@ class ViewTest extends TestCase
49
49
protected function setUp ()
50
50
{
51
51
$ this ->objectManager = Bootstrap::getObjectManager ();
52
- $ this ->_block = $ this ->objectManager ->create (View::class);
52
+ $ this ->block = $ this ->objectManager ->create (View::class);
53
53
$ this ->productRepository = $ this ->objectManager ->create (ProductRepositoryInterface::class);
54
54
$ this ->layout = $ this ->objectManager ->get (LayoutInterface::class);
55
55
$ this ->registry = $ this ->objectManager ->get (Registry::class);
@@ -74,21 +74,21 @@ public function testGetProduct(): void
74
74
$ product = $ this ->productRepository ->get ('simple ' );
75
75
$ this ->registerProduct ($ product );
76
76
77
- $ this ->assertNotEmpty ($ this ->_block ->getProduct ()->getId ());
78
- $ this ->assertEquals ($ product ->getId (), $ this ->_block ->getProduct ()->getId ());
77
+ $ this ->assertNotEmpty ($ this ->block ->getProduct ()->getId ());
78
+ $ this ->assertEquals ($ product ->getId (), $ this ->block ->getProduct ()->getId ());
79
79
80
80
$ this ->registry ->unregister ('product ' );
81
- $ this ->_block ->setProductId ($ product ->getId ());
81
+ $ this ->block ->setProductId ($ product ->getId ());
82
82
83
- $ this ->assertEquals ($ product ->getId (), $ this ->_block ->getProduct ()->getId ());
83
+ $ this ->assertEquals ($ product ->getId (), $ this ->block ->getProduct ()->getId ());
84
84
}
85
85
86
86
/**
87
87
* @return void
88
88
*/
89
89
public function testCanEmailToFriend (): void
90
90
{
91
- $ this ->assertFalse ($ this ->_block ->canEmailToFriend ());
91
+ $ this ->assertFalse ($ this ->block ->canEmailToFriend ());
92
92
}
93
93
94
94
/**
@@ -97,7 +97,7 @@ public function testCanEmailToFriend(): void
97
97
public function testGetAddToCartUrl (): void
98
98
{
99
99
$ product = $ this ->productRepository ->get ('simple ' );
100
- $ url = $ this ->_block ->getAddToCartUrl ($ product );
100
+ $ url = $ this ->block ->getAddToCartUrl ($ product );
101
101
102
102
$ this ->assertStringMatchesFormat (
103
103
'%scheckout/cart/add/%sproduct/ ' . $ product ->getId () . '/ ' ,
@@ -112,7 +112,7 @@ public function testGetJsonConfig(): void
112
112
{
113
113
$ product = $ this ->productRepository ->get ('simple ' );
114
114
$ this ->registerProduct ($ product );
115
- $ config = $ this ->json ->unserialize ($ this ->_block ->getJsonConfig ());
115
+ $ config = $ this ->json ->unserialize ($ this ->block ->getJsonConfig ());
116
116
117
117
$ this ->assertNotEmpty ($ config );
118
118
$ this ->assertArrayHasKey ('productId ' , $ config );
@@ -127,7 +127,7 @@ public function testHasOptions(): void
127
127
$ product = $ this ->productRepository ->get ('simple ' );
128
128
$ this ->registerProduct ($ product );
129
129
130
- $ this ->assertTrue ($ this ->_block ->hasOptions ());
130
+ $ this ->assertTrue ($ this ->block ->hasOptions ());
131
131
}
132
132
133
133
/**
@@ -138,7 +138,7 @@ public function testHasRequiredOptions(): void
138
138
$ product = $ this ->productRepository ->get ('simple ' );
139
139
$ this ->registerProduct ($ product );
140
140
141
- $ this ->assertTrue ($ this ->_block ->hasRequiredOptions ());
141
+ $ this ->assertTrue ($ this ->block ->hasRequiredOptions ());
142
142
}
143
143
144
144
/**
@@ -148,7 +148,7 @@ public function testStartBundleCustomization(): void
148
148
{
149
149
$ this ->markTestSkipped ("Functionality not implemented in Magento 1.x. Implemented in Magento 2 " );
150
150
151
- $ this ->assertFalse ($ this ->_block ->startBundleCustomization ());
151
+ $ this ->assertFalse ($ this ->block ->startBundleCustomization ());
152
152
}
153
153
154
154
/**
@@ -160,8 +160,8 @@ public function testAddToCartBlockInvisibility(): void
160
160
{
161
161
$ outOfStockProduct = $ this ->productRepository ->get ('simple-out-of-stock ' );
162
162
$ this ->registerProduct ($ outOfStockProduct );
163
- $ this ->_block ->setTemplate ('Magento_Catalog::product/view/addtocart.phtml ' );
164
- $ output = $ this ->_block ->toHtml ();
163
+ $ this ->block ->setTemplate ('Magento_Catalog::product/view/addtocart.phtml ' );
164
+ $ output = $ this ->block ->toHtml ();
165
165
166
166
$ this ->assertNotContains ((string )__ ('Add to Cart ' ), $ output );
167
167
}
@@ -173,8 +173,8 @@ public function testAddToCartBlockVisibility(): void
173
173
{
174
174
$ product = $ this ->productRepository ->get ('simple ' );
175
175
$ this ->registerProduct ($ product );
176
- $ this ->_block ->setTemplate ('Magento_Catalog::product/view/addtocart.phtml ' );
177
- $ output = $ this ->_block ->toHtml ();
176
+ $ this ->block ->setTemplate ('Magento_Catalog::product/view/addtocart.phtml ' );
177
+ $ output = $ this ->block ->toHtml ();
178
178
179
179
$ this ->assertContains ((string )__ ('Add to Cart ' ), $ output );
180
180
}
0 commit comments