@@ -98,6 +98,13 @@ public function testInvalidPagination()
98
98
$ ikp ->getPagination ($ ikp ->getNumberOfPages () + 1 );
99
99
}
100
100
101
+ public function testSetMaxButtons ()
102
+ {
103
+ $ ikp = new InlineKeyboardPagination ($ this ->items , $ this ->command , $ this ->selected_page , $ this ->items_per_page );
104
+ $ ikp ->setMaxButtons (6 );
105
+ self ::assertTrue (true );
106
+ }
107
+
101
108
/**
102
109
* @expectedException \TelegramBot\InlineKeyboardPagination\Exceptions\InlineKeyboardPaginationException
103
110
* @expectedExceptionMessage Invalid max buttons, must be between 5 and 8.
@@ -120,6 +127,22 @@ public function testInvalidSelectedPage()
120
127
$ ikp ->getPagination ();
121
128
}
122
129
130
+ public function testGetItemsPerPage ()
131
+ {
132
+ $ ikp = new InlineKeyboardPagination ($ this ->items , $ this ->command , $ this ->selected_page , 4 );
133
+ self ::assertEquals (4 , $ ikp ->getItemsPerPage ());
134
+ }
135
+
136
+ /**
137
+ * @expectedException \TelegramBot\InlineKeyboardPagination\Exceptions\InlineKeyboardPaginationException
138
+ * @expectedExceptionMessage Invalid number of items per page, must be at least 1
139
+ */
140
+ public function testInvalidItemsPerPage ()
141
+ {
142
+ $ ikp = new InlineKeyboardPagination ($ this ->items , $ this ->command , $ this ->selected_page , 0 );
143
+ $ ikp ->getPagination ();
144
+ }
145
+
123
146
public function testButtonLabels ()
124
147
{
125
148
$ cbdata = '%s?currentPage=%d&nextPage=%d ' ;
@@ -185,13 +208,16 @@ public function testButtonLabels()
185
208
186
209
// custom labels, skipping some buttons
187
210
// first, previous, current, next, last
188
- $ ikp10 -> setLabels ( [
211
+ $ labels = [
189
212
'first ' => '' ,
190
213
'previous ' => 'previous %d ' ,
191
214
'current ' => null ,
192
215
'next ' => '%d next ' ,
193
216
'last ' => 'last ' ,
194
- ]);
217
+ ];
218
+ $ ikp10 ->setLabels ($ labels );
219
+ self ::assertEquals ($ labels , $ ikp10 ->getLabels ());
220
+
195
221
$ keyboard = $ ikp10 ->getPagination (5 )['keyboard ' ];
196
222
self ::assertAllButtonPropertiesEqual ([
197
223
['previous 4 ' , '6 next ' , 'last ' ],
0 commit comments