<commit_before><?php
	
	use Railpage\Glossary\Entry;
	use Railpage\Glossary\Type;
	use Railpage\Glossary\Glossary;
	use Railpage\Users\User;
	
	class GlossaryTest extends PHPUnit_Framework_TestCase {
		
		const TYPE = "Slang";
		const NAME = "Testing";
		const TEXT = "Evaluating a situation to see if the expected outcome matches the actual outcome";
		const EXAMPLE = "I'm testing Railpage's code by running it through PHPUnit";
		const AUTHOR = "Glossary tester";
		
		public function testAddUser() {
			
			$User = new User;
			$User->username = self::AUTHOR;
			$User->setPassword('<PASSWORD>');
			$User->contact_email = "<EMAIL>";
			$User->commit(); 
			
			$this->assertFalse(!filter_var($User->id, FILTER_VALIDATE_INT));
			
			return $User;
			
		}
		
		/**
		 * @depends testAddUser
		 */
		
		public function testAddEntry($User) {
			
			$Type = new Type(self::TYPE);
			$Entry = new Entry;
			$Entry->name = self::NAME;
			$Entry->text = self::TEXT;
			$Entry->example = self::EXAMPLE;
			$Entry->Type = $Type;
			$Entry->setAuthor($User); 
			
			$Entry->commit(); 
			
			$Entry->name = "test"; 
			$Entry->commit(); 
			$Entry->name = self::NAME;
			$Entry->commit(); 
			
			$Entry = new Entry($Entry->id);
			
			$this->assertFalse(!filter_var($Entry->id, FILTER_VALIDATE_INT));
			
			$this->assertEquals($User->id, $Entry->Author->id);
			
			$Entry->approve(); 
			
			return $Entry;
			
		}
		
		/**
		 * @depends testAddEntry
		 */
		
		public function testCompareEntry($Entry) {
			
			$NewEntry = new Entry($Entry->id); 
			
			$this->assertEquals($Entry->name, $NewEntry->name);
			
			$this->assertEquals(self::TYPE, $NewEntry->Type->name); 
			$this->assertEquals(self::NAME, $NewEntry->name);
			$this->assertEquals(self::TEXT, $NewEntry->text); 
			$this->assertEquals(self::EXAMPLE, $NewEntry->example); 
			$this->assertEquals($Entry->Author->id, $NewEntry->Author->id); 
			$this->assertEquals($Entry->Author->username, $NewEntry->Author->username); 
			
		}
		
		/**
		 * @depends testAddEntry
		 */
		
		public function testGetEntry() {
			
			$Type = new Type(self::TYPE); 
			
			foreach ($Type->getEntries() as $Entry) {
				$this->assertEquals(self::NAME, $Entry->name); 
			}
			
		}
		
		public function test_loadTypes() {
			
			$types = [ "code", "acronym", "station", "slang", "general", "term" ];
			
			foreach ($types as $type) {
				
				$GlossaryType = new Type($type); 
				
			}
		}
		
		/**
		 * @depends testAddUser<commit_msg>Weird issue with PHP7<commit_after><?php
	
	use Railpage\Glossary\Entry;
	use Railpage\Glossary\Type;
	use Railpage\Glossary\Glossary;
	use Railpage\Users\User;
	
	class GlossaryTest extends PHPUnit_Framework_TestCase {
		
		const TYPE = "Slang";
		const NAME = "Testing";
		const TEXT = "Evaluating a situation to see if the expected outcome matches the actual outcome";
		const EXAMPLE = "I'm testing Railpage's code by running it through PHPUnit";
		const AUTHOR = "Glossary tester";
		
		public function testAddUser() {
			
			$User = new User;
			$User->username = self::AUTHOR;
			$User->setPassword('<PASSWORD>');
			$User->contact_email = "<EMAIL>";
			$User->commit(); 
			
			$this->assertFalse(!filter_var($User->id, FILTER_VALIDATE_INT));
			
			return $User;
			
		}
		
		/**
		 * @depends testAddUser
		 */
		
		public function testAddEntry($User) {
			
			$Type = new Type(self::TYPE);
			$Entry = new Entry;
			$Entry->name = self::NAME;
			$Entry->text = self::TEXT;
			$Entry->example = self::EXAMPLE;
			$Entry->Type = $Type;
			$Entry->setAuthor($User); 
			
			$Entry->commit(); 
			
			$Entry->name = "test"; 
			$Entry->commit(); 
			$Entry->name = self::NAME;
			$Entry->commit(); 
			
			$Entry = new Entry($Entry->id);
			
			$this->assertFalse(!filter_var($Entry->id, FILTER_VALIDATE_INT));
			
			$this->assertEquals($User->id, $Entry->Author->id);
			
			$Entry->approve(); 
			
			return $Entry;
			
		}
		
		/**
		 * @depends testAddEntry
		 * @depends testAddUser
		 */
		
		public function testCompareEntry($Entry, $User) {
			
			$NewEntry = new Entry($Entry->id); 
			
			$this->assertEquals($Entry->name, $NewEntry->name);
			
			$this->assertEquals(self::TYPE, $NewEntry->Type->name); 
			$this->assertEquals(self::NAME, $NewEntry->name);
			$this->assertEquals(self::TEXT, $NewEntry->text); 
			$this->assertEquals(self::EXAMPLE, $NewEntry->example); 
			$this->assertEquals($Entry->Author->id, $NewEntry->Author->id); 
			$this->assertEquals($Entry->Author->username, $NewEntry->Author->username); 
			
			$this->assertEquals($Entry->Author->id, $User->id); 
			$this->assertTrue($User->id > 0);
			
		}
		
		/**
		 * @depends testAddEntry
		 */
		
		public function testGetEntry() {
			
			$Type = new Type(self::TYPE); 
			
			foreach ($Type->getEntries() as $Entry) {
				$this->assertEquals(self::NAME, $Entry->name); 
			}
			
		}
		
		public function test_loadTypes() {
			
			$types = [ "code", "acronym", "station", "slang", "general", "term" ];
			
			foreach ($types as $type) {
				
				$GlossaryType = new Type($type); 
				
			}
		}
		
		/**
		 * @depends testAddUser
{'fraction_non_alphanumeric': 0.1727450980392157, 'fraction_numerical': 0.000392156862745098, 'mean_word_length': 3.1103948428686543, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 114, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3300117', 'n_tokens_mistral': 2138, 'n_tokens_neox': 1662, 'n_words': 323}