@@ -117,6 +117,37 @@ public function testPrintInvoice(): void
117
117
$ order = $ this ->orderFactory ->create ()->loadByIncrementId ('100000555 ' );
118
118
$ invoice = $ order ->getInvoiceCollection ()->getFirstItem ();
119
119
$ this ->assertNotNull ($ invoice ->getId ());
120
+ $ this ->assertTrue (is_numeric ($ invoice ->getIncrementId ()));
121
+ $ this ->registerOrder ($ order );
122
+ $ this ->registerInvoice ($ invoice );
123
+ $ blockHtml = $ this ->renderPrintInvoiceBlock ();
124
+ $ this ->assertEquals (
125
+ 1 ,
126
+ Xpath::getElementsCountForXpath (
127
+ sprintf (
128
+ "//div[contains(@class, 'order-title')]/strong[contains(text(), '%s')] " ,
129
+ __ ('Invoice #%1 ' , $ invoice ->getIncrementId ())
130
+ ),
131
+ $ blockHtml
132
+ ),
133
+ sprintf ('Title for %s was not found. ' , __ ('Invoice #%1 ' , $ invoice ->getIncrementId ()))
134
+ );
135
+ $ this ->assertOrderInformation ($ order , $ blockHtml );
136
+ }
137
+
138
+ /**
139
+ * @magentoDataFixture Magento/Sales/_files/invoices_for_items.php
140
+ *
141
+ * @return void
142
+ */
143
+ public function testPrintInvoiceWithStringPrefix (): void
144
+ {
145
+ $ order = $ this ->orderFactory ->create ()->loadByIncrementId ('100000555 ' );
146
+ $ invoice = $ order ->getInvoiceCollection ()->getFirstItem ();
147
+ $ this ->assertNotNull ($ invoice ->getId ());
148
+ // set text prefix to increment id
149
+ $ invoice ->setIncrementId ('prefix- ' . $ invoice ->getIncrementId ());
150
+ $ this ->assertFalse (is_numeric ($ invoice ->getIncrementId ()));
120
151
$ this ->registerOrder ($ order );
121
152
$ this ->registerInvoice ($ invoice );
122
153
$ blockHtml = $ this ->renderPrintInvoiceBlock ();
0 commit comments