1+ <?php
2+ /**
3+ * Created by PhpStorm.
4+ * User: andreicotaga
5+ * Date: 2019-05-29
6+ * Time: 11:06
7+ */
8+
9+ namespace Tests \Unit ;
10+
11+ use PHPUnit \Framework \TestCase ;
12+ use RetargetingSDK \RecommendationEngine ;
13+
14+ /**
15+ * Class RecommendationEngineTest
16+ * @package Tests\Unit
17+ * @property RecommendationEngine engine
18+ */
19+ class RecommendationEngineTest extends TestCase
20+ {
21+ public function setUp (): void
22+ {
23+ $ this ->engine = new RecommendationEngine ();
24+ }
25+
26+ /**
27+ * Test if mark home page returns correct div with correct id
28+ */
29+ public function test_if_mark_home_page_return_correct_value ()
30+ {
31+ $ this ->engine ->markHomePage ();
32+
33+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-home-page"></div> ' );
34+ }
35+
36+ /**
37+ * Test if mark category page returns correct div with correct id
38+ */
39+ public function test_if_mark_category_page_return_correct_value ()
40+ {
41+ $ this ->engine ->markCategoryPage ();
42+
43+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-category-page"></div> ' );
44+ }
45+
46+ /**
47+ * Test if mark product page returns correct div with correct id
48+ */
49+ public function test_if_mark_product_page_return_correct_value ()
50+ {
51+ $ this ->engine ->markProductPage ();
52+
53+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-product-page"></div> ' );
54+ }
55+
56+ /**
57+ * Test if mark checkout page returns correct div with correct id
58+ */
59+ public function test_if_mark_checkout_page_return_correct_value ()
60+ {
61+ $ this ->engine ->markCheckoutPage ();
62+
63+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-checkout-page"></div> ' );
64+ }
65+
66+ /**
67+ * Test if mark thank you page returns correct div with correct id
68+ */
69+ public function test_if_mark_thankyou_page_return_correct_value ()
70+ {
71+ $ this ->engine ->markThankYouPage ();
72+
73+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-thank-you-page"></div> ' );
74+ }
75+
76+ /**
77+ * Test if mark out of stock page returns correct div with correct id
78+ */
79+ public function test_if_mark_out_of_stock_page_return_correct_value ()
80+ {
81+ $ this ->engine ->markOutOfStockPage ();
82+
83+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-out-of-stock-page"></div> ' );
84+ }
85+
86+ /**
87+ * Test if mark search page returns correct div with correct id
88+ */
89+ public function test_if_mark_search_page_return_correct_value ()
90+ {
91+ $ this ->engine ->markSearchPage ();
92+
93+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-search-page"></div> ' );
94+ }
95+
96+ /**
97+ * Test if mark not found page returns correct div with correct id
98+ */
99+ public function test_if_mark_notfound_page_return_correct_value ()
100+ {
101+ $ this ->engine ->markNotFoundPage ();
102+
103+ $ this ->assertEquals ($ this ->engine ->generateTags (), '<div id="retargeting-recommeng-not-found-page"></div> ' );
104+ }
105+
106+ /**
107+ * Test if generate tags returns string format data
108+ */
109+ public function test_if_generate_tags_returns_string ()
110+ {
111+ $ this ->engine ->markSearchPage ();
112+
113+ $ this ->assertIsString ($ this ->engine ->generateTags ());
114+ }
115+ }
0 commit comments