File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,32 @@ public function testAddPlausibleAttributes() {
2929
3030		$ this  ->assertStringNotContainsString ( 'plausible-analytics-js ' , $ tag  );
3131	}
32+ 
33+ 	/** 
34+ 	 * @see Filters::maybe_track_logged_in_users() 
35+ 	 * 
36+ 	 * @return void 
37+ 	 */ 
38+ 	public  function  testTrackLoggedInUsers () {
39+ 		$ class  = new  Filters ();
40+ 
41+ 		add_filter ( 'plausible_analytics_settings ' , [ $ this  , 'enablePageviewProps '  ] );
42+ 
43+ 		$ params  = $ class ->maybe_track_logged_in_users ( ''  );
44+ 
45+ 		$ this  ->assertStringContainsString ( 'no ' , $ params  );
46+ 
47+ 		global  $ current_user ;
48+ 
49+ 		$ user          = new  \WP_User ();
50+ 		$ user ->ID      = 1 ;
51+ 		$ user ->roles   = [ 'test '  ];
52+ 		$ current_user  = $ user ;
53+ 
54+ 		$ params  = $ class ->maybe_track_logged_in_users ( ''  );
55+ 
56+ 		remove_filter ( 'plausible_analytics_settings ' , [ $ this  , 'enablePageviewProps '  ] );
57+ 
58+ 		$ this  ->assertStringContainsString ( 'test ' , $ params  );
59+ 	}
3260}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments