Ejemplo n.º 1
0
 /**
  * Test getting results from matching values
  * @since 1.1.0
  *
  * @group utility
  * @group array_filter
  *
  * @covers \ingot\testing\utility\array_filters::filter_values()
  * @covers \ingot\testing\utility\array_filters::match()
  * @covers \ingot\testing\utility\array_filters::prepare()
  */
 public function testResultsValues()
 {
     $data = ['ingot_destination_19' => 12, 'ingot_destination_12142' => 17, 'ingot_destination_4899898', 'hi chris', 'ingot_97' => 94, 'ingot_destination' => 88, 'hats_8765' => ['batman', 'robin']];
     $results = \ingot\testing\utility\array_filters::filter_values($data, 'ingot_destination_');
     $this->assertEquals([12, 17], $results);
 }
Ejemplo n.º 2
0
 /**
  * Get all destination cookies
  *
  * @since 1.1.0
  *
  * @return array
  */
 public static function get_all_cookies()
 {
     if (isset($_COOKIE) && is_array($_COOKIE)) {
         return \ingot\testing\utility\array_filters::filter_results($_COOKIE, 'ingot_destination_');
     } else {
         return [];
     }
 }