PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.6.7
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.6.7
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / tests / Unit / Doubles / FeedCacheWpdbDouble.php
reviews-feed / tests / Unit / Doubles Last commit date
FeedCacheWpdbDouble.php 2 months ago
FeedCacheWpdbDouble.php
57 lines
1 <?php
2
3 namespace SmashBalloon\Reviews\Tests\Unit\Doubles;
4
5 /**
6 * Minimal `wpdb` test double for FeedCacheUpdateServiceTest.
7 *
8 * Captures the SQL handed to prepare()/get_results() so the dedupe + ordering
9 * contract on `FeedCacheUpdateService::feed_caches_query()` can be asserted
10 * without a live database. Exists in its own file (PSR1 — one class per file)
11 * and uses untyped properties (PHP 7.1+ baseline per phpcs.xml).
12 */
13 class FeedCacheWpdbDouble
14 {
15 /** @var string */
16 public $prefix = 'wp_';
17
18 /** @var string|null */
19 public $last_prepared_sql = null;
20
21 /** @var array<int, mixed> */
22 public $last_prepared_args = array();
23
24 /** @var string|null */
25 public $last_get_results_sql = null;
26
27 /** @var array<int, array<string, mixed>> */
28 public $next_results = array();
29
30 /**
31 * @param string $sql
32 * @param mixed ...$args
33 * @return string
34 */
35 public function prepare($sql, ...$args)
36 {
37 $this->last_prepared_sql = $sql;
38 $this->last_prepared_args = $args;
39 // We don't need a real interpolation — the production code reads the
40 // returned string and immediately hands it to get_results, which we
41 // also intercept. Returning the raw template is enough for the
42 // behavioral assertions in this suite.
43 return $sql;
44 }
45
46 /**
47 * @param string $sql
48 * @param string $output_type
49 * @return array<int, array<string, mixed>>
50 */
51 public function get_results($sql, $output_type = 'OBJECT')
52 {
53 $this->last_get_results_sql = $sql;
54 return $this->next_results;
55 }
56 }
57