Skip to content

Commit

Permalink
Test stats values
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Feb 22, 2024
1 parent a084cda commit e86264e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/stats-listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private function get_stats(): array {
global $wpdb;
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching
return $wpdb->get_results( 'select * from wp_wporg_gp_translation_events_actions' );
return $wpdb->get_results( 'select * from wp_wporg_gp_translation_events_actions', ARRAY_A );
// phpcs:enable
}

Expand All @@ -40,8 +40,13 @@ public function test_stores_action_create() {

$stats = $this->get_stats();

// TODO.
$this->assertNotEmpty( $stats );
$this->assertCount( 1, $stats );
$stats = $stats[0];
$this->assertEquals( $event_id, $stats['event_id'] );
$this->assertEquals( $user_id, $stats['user_id'] );
$this->assertEquals( $translation->id, $stats['translation_id'] );
$this->assertEquals( 'create', $stats['action'] );
$this->assertEquals( 'aa', $stats['locale'] );
}

public function test_stores_action_approve() {
Expand Down

0 comments on commit e86264e

Please sign in to comment.