Further adjusting tests for user config
Renamed Rating to ImageRating to prevent test system from trying to make an extension of it
This commit is contained in:
		
							parent
							
								
									3560a19f79
								
							
						
					
					
						commit
						aa5a04fbd3
					
				| @ -20,12 +20,12 @@ | ||||
|  */ | ||||
| 
 | ||||
|  /** | ||||
|  * @global Rating[] $_shm_ratings | ||||
|  * @global ImageRating[] $_shm_ratings | ||||
|  */ | ||||
| global $_shm_ratings; | ||||
| $_shm_ratings = []; | ||||
| 
 | ||||
| class Rating { | ||||
| class ImageRating { | ||||
|     /** | ||||
|      * @var string | ||||
|      */ | ||||
| @ -71,7 +71,7 @@ function clear_ratings() { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| function add_rating(Rating $rating) { | ||||
| function add_rating(ImageRating $rating) { | ||||
|     global $_shm_ratings; | ||||
| 
 | ||||
|     if($rating->code=="?"&&array_key_exists("?",$_shm_ratings)) { | ||||
| @ -80,11 +80,11 @@ function add_rating(Rating $rating) { | ||||
|     $_shm_ratings[$rating->code] = $rating; | ||||
| } | ||||
| 
 | ||||
| add_rating(new Rating("?", "Unrated", "unrated", 99999)); | ||||
| add_rating(new ImageRating("?", "Unrated", "unrated", 99999)); | ||||
| 
 | ||||
| add_rating(new Rating("s", "Safe", "safe", 0)); | ||||
| add_rating(new Rating("q", "Questionable", "questionable", 500)); | ||||
| add_rating(new Rating("e", "Explicit", "explicit", 1000)); | ||||
| add_rating(new ImageRating("s", "Safe", "safe", 0)); | ||||
| add_rating(new ImageRating("q", "Questionable", "questionable", 500)); | ||||
| add_rating(new ImageRating("e", "Explicit", "explicit", 1000)); | ||||
| @include_once "data/config/ratings.conf.php"; | ||||
| 
 | ||||
| class RatingSetEvent extends Event | ||||
|  | ||||
| @ -16,9 +16,6 @@ if (is_null(User::by_name("demo"))) { | ||||
|     $userPage->onUserCreation(new UserCreationEvent("test", "test", "")); | ||||
| } | ||||
| 
 | ||||
| global $user; | ||||
| send_event(new InitUserConfigEvent($user)); | ||||
| 
 | ||||
| abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase | ||||
| { | ||||
|     private $images = []; | ||||
| @ -135,16 +132,16 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase | ||||
|     { | ||||
|         global $user; | ||||
|         $user = User::by_name('demo'); | ||||
|         send_event(new InitUserConfigEvent($user)); | ||||
|         $this->assertNotNull($user); | ||||
|         send_event(new InitUserConfigEvent($user)); | ||||
|     } | ||||
| 
 | ||||
|     protected function log_in_as_user() | ||||
|     { | ||||
|         global $user; | ||||
|         $user = User::by_name('test'); | ||||
|         send_event(new InitUserConfigEvent($user)); | ||||
|         $this->assertNotNull($user); | ||||
|         send_event(new InitUserConfigEvent($user)); | ||||
|     } | ||||
| 
 | ||||
|     protected function log_out() | ||||
| @ -152,6 +149,7 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase | ||||
|         global $user, $config; | ||||
|         $user = User::by_id($config->get_int("anon_id", 0)); | ||||
|         $this->assertNotNull($user); | ||||
|         send_event(new InitUserConfigEvent($user)); | ||||
|     } | ||||
| 
 | ||||
|     // post things
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user