@@ -46,7 +46,7 @@ abstract class CommonITILSatisfaction extends DbTestCase
4646 */
4747 protected function getTestedClass (): string
4848 {
49- $ test_class = static ::class;
49+ $ test_class = str_replace ( ' Test ' , '' , static ::class) ;
5050 // Rule class has the same name as the test class but in the global namespace
5151 return substr (strrchr ($ test_class , '\\' ), 1 );
5252 }
@@ -57,7 +57,7 @@ public function testGetItemtype()
5757 $ tested_class = $ this ->getTestedClass ();
5858 $ itemtype = $ tested_class ::getItemtype ();
5959 // Verify the itemtype is a subclass of CommonITILObject
60- $ this ->boolean (is_a ($ itemtype , \CommonITILObject::class, true ))-> isTrue ( );
60+ $ this ->assertTrue (is_a ($ itemtype , \CommonITILObject::class, true ));
6161 }
6262
6363 public function testGetSurveyUrl ()
@@ -75,7 +75,7 @@ public function testGetSurveyUrl()
7575 'entities_id ' => $ root_entity_id ,
7676 'solvedate ' => $ _SESSION ['glpi_currenttime ' ],
7777 ]);
78- $ this ->integer ( $ items_id)-> isGreaterThan ( 0 );
78+ $ this ->assertGreaterThan ( 0 , $ items_id );
7979
8080 $ this ->login (); // Authorized user required to update entity config
8181
@@ -84,25 +84,25 @@ public function testGetSurveyUrl()
8484 $ config_suffix = $ itemtype === 'Ticket ' ? '' : ('_ ' . strtolower ($ itemtype ));
8585 $ inquest_url = "[ITEMTYPE],[ITEMTYPE_NAME],[ {$ tag_prefix }_ID],[ {$ tag_prefix }_NAME],[ {$ tag_prefix }_CREATEDATE],
8686 [ {$ tag_prefix }_SOLVEDATE],[ {$ tag_prefix }_PRIORITY] " ;
87- $ this ->boolean (
87+ $ this ->assertTrue (
8888 $ entity ->update ([
8989 'id ' => $ root_entity_id ,
9090 'inquest_URL ' . $ config_suffix => $ inquest_url ,
9191 'inquest_config ' . $ config_suffix => \CommonITILSatisfaction::TYPE_EXTERNAL ,
9292 ])
93- )-> isTrue () ;
93+ );
9494
9595 $ expected = "{$ itemtype }, {$ item ->getTypeName (1 )}, {$ items_id }, {$ item ->fields ['name ' ]}, {$ item ->getField ('date ' )},
9696 {$ item ->getField ('solvedate ' )}, {$ item ->getField ('priority ' )}" ;
9797 $ generated = \Entity::generateLinkSatisfaction ($ item );
98- $ this ->string ( $ generated )-> isEqualTo ( $ expected );
98+ $ this ->assertEquals ( $ expected, $ generated );
9999 }
100100
101101 public function testGetIndexName ()
102102 {
103103 $ index_name = $ this ->getTestedClass ()::getIndexName ();
104- $ this ->boolean (is_string ($ index_name ))-> isTrue ( );
105- $ this ->string ($ index_name)-> isNotEmpty ( );
104+ $ this ->assertTrue (is_string ($ index_name ));
105+ $ this ->assertNotEmpty ($ index_name );
106106 }
107107
108108 public function testGetLogTypeID ()
@@ -118,7 +118,7 @@ public function testGetLogTypeID()
118118 'entities_id ' => getItemByTypeName ('Entity ' , '_test_root_entity ' , true ),
119119 'solvedate ' => $ _SESSION ['glpi_currenttime ' ],
120120 ]);
121- $ this ->integer ( $ items_id)-> isGreaterThan ( 0 );
121+ $ this ->assertGreaterThan ( 0 , $ items_id );
122122
123123 // Add a satisfaction
124124 /** @var \CommonITILSatisfaction $satisfaction */
@@ -131,14 +131,14 @@ public function testGetLogTypeID()
131131 'type ' => \CommonITILSatisfaction::TYPE_INTERNAL ,
132132 'date ' => $ _SESSION ['glpi_currenttime ' ],
133133 ]);
134- $ this ->integer ( $ satisfaction_id)-> isGreaterThan ( 0 );
134+ $ this ->assertGreaterThan ( 0 , $ satisfaction_id );
135135
136136 $ log_type = $ satisfaction ->getLogTypeID ();
137- $ this ->boolean ( is_array ( $ log_type))-> isTrue ( );
138- $ this ->array ( $ log_type)-> size -> isEqualTo ( 2 );
139- $ this ->string ( $ log_type [0 ])-> isEqualTo ( $ itilobject_type );
137+ $ this ->assertIsArray ( $ log_type );
138+ $ this ->assertCount ( 2 , $ log_type );
139+ $ this ->assertEquals ( $ itilobject_type , $ log_type [0 ]);
140140
141- $ this ->integer ( $ log_type [1 ])-> isEqualTo ( $ items_id );
141+ $ this ->assertEquals ( $ items_id , $ log_type [1 ]);
142142 }
143143
144144 public function testDateAnsweredSetOnAnswer ()
@@ -156,11 +156,11 @@ public function testDateAnsweredSetOnAnswer()
156156 'solvedate ' => $ _SESSION ['glpi_currenttime ' ],
157157 'users_id_recipient ' => getItemByTypeName ('User ' , TU_USER , true ),
158158 ]);
159- $ this ->integer ( $ items_id)-> isGreaterThan ( 0 );
159+ $ this ->assertGreaterThan ( 0 , $ items_id );
160160
161- $ this ->boolean ($ item ->addTeamMember ('User ' , getItemByTypeName ('User ' , TU_USER , true ), [
161+ $ this ->assertTrue ($ item ->addTeamMember ('User ' , getItemByTypeName ('User ' , TU_USER , true ), [
162162 'role ' => Team::ROLE_REQUESTER ,
163- ]))-> isTrue () ;
163+ ]));
164164
165165 // Add a satisfaction
166166 /** @var \CommonITILSatisfaction $satisfaction */
@@ -173,17 +173,17 @@ public function testDateAnsweredSetOnAnswer()
173173 'type ' => \CommonITILSatisfaction::TYPE_INTERNAL ,
174174 'date ' => $ _SESSION ['glpi_currenttime ' ],
175175 ]);
176- $ this ->integer ( $ satisfaction_id)-> isGreaterThan ( 0 );
177- $ this ->variable ($ satisfaction ->fields ['date_answered ' ])-> isNull ( );
176+ $ this ->assertGreaterThan ( 0 , $ satisfaction_id );
177+ $ this ->assertNull ($ satisfaction ->fields ['date_answered ' ]);
178178
179179 $ this ->login ();
180180
181- $ this ->boolean ($ satisfaction ->update ([
181+ $ this ->assertTrue ($ satisfaction ->update ([
182182 $ itilobject_type ::getForeignKeyField () => $ items_id , // These items don't use `id` as the index field...
183183 'satisfaction ' => 5
184- ]))-> isTrue () ;
184+ ]));
185185
186- $ this ->variable ($ satisfaction ->fields ['date_answered ' ])-> isNotNull ( );
187- $ this ->string ( $ satisfaction -> fields [ ' date_answered ' ])-> isEqualTo ( $ _SESSION [ ' glpi_currenttime ' ]);
186+ $ this ->assertNotNull ($ satisfaction ->fields ['date_answered ' ]);
187+ $ this ->assertEquals ( $ _SESSION [ ' glpi_currenttime ' ], $ satisfaction -> fields [ ' date_answered ' ]);
188188 }
189189}
0 commit comments