- Timestamp:
- 01/14/2017 01:32:34 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/groups/class-bp-groups-group.php
r11104 r11383 307 307 308 308 /** 309 * @group get 310 */ 311 public function test_get_search_with_left_wildcard() { 312 $g1 = $this->factory->group->create( array( 313 'name' => 'Ye Lads', 314 'description' => "My Bonnie lies over the ocean", 315 ) ); 316 $g2 = $this->factory->group->create(); 317 318 $groups = BP_Groups_Group::get( array( 319 'search_terms' => "*ads", 320 ) ); 321 322 $found = wp_list_pluck( $groups['groups'], 'id' ); 323 324 $this->assertEquals( array( $g1 ), $found ); 325 } 326 327 /** 328 * @group get 329 */ 330 public function test_get_search_with_left_wildcard_should_miss() { 331 $g1 = $this->factory->group->create( array( 332 'name' => 'Ye Lads', 333 'description' => "My Bonnie lies over the ocean", 334 ) ); 335 $g2 = $this->factory->group->create(); 336 337 $groups = BP_Groups_Group::get( array( 338 'search_terms' => "*la", 339 ) ); 340 341 $found = wp_list_pluck( $groups['groups'], 'id' ); 342 343 $this->assertEquals( array(), $found ); 344 } 345 346 /** 347 * @group get 348 */ 349 public function test_get_search_with_right_wildcard() { 350 $g1 = $this->factory->group->create( array( 351 'name' => 'Ye Lads', 352 'description' => "My Bonnie lies over the ocean", 353 ) ); 354 $g2 = $this->factory->group->create(); 355 356 $groups = BP_Groups_Group::get( array( 357 'search_terms' => "Ye*", 358 ) ); 359 360 $found = wp_list_pluck( $groups['groups'], 'id' ); 361 362 $this->assertEquals( array( $g1 ), $found ); 363 } 364 365 /** 366 * @group get 367 */ 368 public function test_get_search_with_right_wildcard_should_miss() { 369 $g1 = $this->factory->group->create( array( 370 'name' => 'Ye Lads', 371 'description' => "My Bonnie lies over the ocean", 372 ) ); 373 $g2 = $this->factory->group->create(); 374 375 $groups = BP_Groups_Group::get( array( 376 'search_terms' => "la*", 377 ) ); 378 379 $found = wp_list_pluck( $groups['groups'], 'id' ); 380 381 $this->assertEquals( array(), $found ); 382 } 383 384 /** 385 * @group get 386 */ 387 public function test_get_search_with_both_wildcard() { 388 $g1 = $this->factory->group->create( array( 389 'name' => 'Ye Lads', 390 'description' => "My Bonnie lies over the ocean", 391 ) ); 392 $g2 = $this->factory->group->create(); 393 394 $groups = BP_Groups_Group::get( array( 395 'search_terms' => "*la*", 396 ) ); 397 398 $found = wp_list_pluck( $groups['groups'], 'id' ); 399 400 $this->assertEquals( array( $g1 ), $found ); 401 } 402 403 /** 404 * @group get 405 */ 406 public function test_get_search_limited_to_name_column() { 407 $g1 = $this->factory->group->create( array( 408 'name' => 'Ye Lads', 409 'description' => "My Bonnie lies over the ocean", 410 ) ); 411 $g2 = $this->factory->group->create(); 412 $g3 = $this->factory->group->create( array( 413 'name' => 'Bonnie Lasses', 414 'description' => "That lad is unknown to me", 415 ) ); 416 417 $groups = BP_Groups_Group::get( array( 418 'search_terms' => "lad", 419 'search_columns' => array( 'name' ), 420 ) ); 421 422 $found = wp_list_pluck( $groups['groups'], 'id' ); 423 424 $this->assertEquals( array( $g1 ), $found ); 425 } 426 427 /** 428 * @group get 429 */ 430 public function test_get_search_limited_to_description_column() { 431 $g1 = $this->factory->group->create( array( 432 'name' => 'Ye Lads', 433 'description' => "My Bonnie lies over the ocean", 434 ) ); 435 $g2 = $this->factory->group->create(); 436 $g3 = $this->factory->group->create( array( 437 'name' => 'Bonnie Lasses', 438 'description' => "That lad is unknown to me", 439 ) ); 440 441 $groups = BP_Groups_Group::get( array( 442 'search_terms' => "lad", 443 'search_columns' => array( 'description' ), 444 ) ); 445 446 $found = wp_list_pluck( $groups['groups'], 'id' ); 447 448 $this->assertEquals( array( $g3 ), $found ); 449 } 450 451 /** 309 452 * BP 1.8 will change the default 'type' param in favor of default 310 453 * 'order' and 'orderby'. This is to make sure that existing plugins
Note: See TracChangeset
for help on using the changeset viewer.