File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ public static function normalizeTypeName($name)
216216 public static function isRepeaterTemplate (Template $ template )
217217 {
218218 // if it's not prefixed with "repeater_" then it's not a repeater template
219- if (strpos ($ template ->name , 'repeater_ ' !== 0 ) ) {
219+ if (strpos ($ template ->name , 'repeater_ ' ) !== 0 ) {
220220 return false ;
221221 }
222222
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace ProcessWire \GraphQL \Test ;
4+
5+ use ProcessWire \Template ;
6+ use ProcessWire \GraphQL \Test \GraphqlTestCase ;
7+ use ProcessWire \GraphQL \Utils ;
8+
9+ class UtilsTest extends GraphQLTestCase
10+ {
11+ public static function testIsRepeaterTemplate ()
12+ {
13+ $ repeaterTemplate = new Template ();
14+ $ repeaterTemplate ->name = 'something ' ;
15+ assertFalse (Utils::isRepeaterTemplate ($ repeaterTemplate ), 'Incorrectly marks template as a repeater. ' );
16+ $ repeaterTemplate ->name = 'repeater_something ' ;
17+ assertFalse (Utils::isRepeaterTemplate ($ repeaterTemplate ), 'Incorrectly marks template as a repeater. ' );
18+ $ repeaterTemplate ->flags = $ repeaterTemplate ->flags | Template::flagSystem;
19+ assertTrue (Utils::isRepeaterTemplate ($ repeaterTemplate ), 'Does not properly detect a repeater template. ' );
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments