Code Duplication    Length = 24-25 lines in 2 locations

tests/forms/RequirementsTest.php 2 locations

@@ 826-850 (lines=25) @@
823
	 * @param string $type js or css
824
	 * @param array|string $files Files or list of files to check
825
	 */
826
	public function assertFileIncluded($backend, $type, $files) {
827
		$includedFiles = $this->getBackendFiles($backend, $type);
828
829
		if(is_array($files)) {
830
			$failedMatches = array();
831
			foreach ($files as $file) {
832
				if(!array_key_exists($file, $includedFiles)) {
833
					$failedMatches[] = $file;
834
				}
835
			}
836
			$this->assertTrue(
837
				(count($failedMatches) == 0),
838
				"Failed asserting the $type files '"
839
				. implode("', '", $failedMatches)
840
				. "' have exact matches in the required elements:\n'"
841
				. implode("'\n'", array_keys($includedFiles)) . "'"
842
			);
843
		} else {
844
			$this->assertTrue(
845
				(array_key_exists($files, $includedFiles)),
846
				"Failed asserting the $type file '$files' has an exact match in the required elements:\n'"
847
				. implode("'\n'", array_keys($includedFiles)) . "'"
848
			);
849
		}
850
	}
851
852
	public function assertFileNotIncluded($backend, $type, $files) {
853
		$includedFiles = $this->getBackendFiles($backend, $type);
@@ 852-875 (lines=24) @@
849
		}
850
	}
851
852
	public function assertFileNotIncluded($backend, $type, $files) {
853
		$includedFiles = $this->getBackendFiles($backend, $type);
854
		if(is_array($files)) {
855
			$failedMatches = array();
856
			foreach ($files as $file) {
857
				if(array_key_exists($file, $includedFiles)) {
858
					$failedMatches[] = $file;
859
				}
860
			}
861
			$this->assertTrue(
862
				(count($failedMatches) == 0),
863
				"Failed asserting the $type files '"
864
				. implode("', '", $failedMatches)
865
				. "' do not have exact matches in the required elements:\n'"
866
				. implode("'\n'", array_keys($includedFiles)) . "'"
867
			);
868
		} else {
869
			$this->assertFalse(
870
				(array_key_exists($files, $includedFiles)),
871
				"Failed asserting the $type file '$files' does not have an exact match in the required elements:"
872
						. "\n'" . implode("'\n'", array_keys($includedFiles)) . "'"
873
			);
874
		}
875
	}
876
877
878
	/**