Code Duplication    Length = 18-18 lines in 4 locations

packages/autoloader/tests/php/tests/test_integration_loader.php 4 locations

@@ 55-72 (lines=18) @@
52
	/**
53
	 * Tests that the classmap manifest from a single plugin can be handled correctly.
54
	 */
55
	public function test_single_plugin_classmap() {
56
		$path_map = array();
57
		$this->single_manifest_handler->register_plugin_manifests(
58
			'vendor/composer/jetpack_autoload_classmap.php',
59
			$path_map
60
		);
61
62
		$loader = new Version_Loader(
63
			new Version_Selector(),
64
			$path_map,
65
			null,
66
			null
67
		);
68
69
		$file = $loader->find_class_file( Test::class );
70
71
		$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_current/includes/class-test.php', $file );
72
	}
73
74
	/**
75
	 * Tests that the classmap manifest from multiple plugins can be handled correctly.
@@ 77-94 (lines=18) @@
74
	/**
75
	 * Tests that the classmap manifest from multiple plugins can be handled correctly.
76
	 */
77
	public function test_multiple_plugin_classmap() {
78
		$path_map = array();
79
		$this->multiple_manifest_handler->register_plugin_manifests(
80
			'vendor/composer/jetpack_autoload_classmap.php',
81
			$path_map
82
		);
83
84
		$loader = new Version_Loader(
85
			new Version_Selector(),
86
			$path_map,
87
			null,
88
			null
89
		);
90
91
		$file = $loader->find_class_file( Test::class );
92
93
		$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_newer/includes/class-test.php', $file );
94
	}
95
96
	/**
97
	 * Tests that the PSR-4 manifest from a single plugin can be handled correctly.
@@ 99-116 (lines=18) @@
96
	/**
97
	 * Tests that the PSR-4 manifest from a single plugin can be handled correctly.
98
	 */
99
	public function test_single_plugin_psr4() {
100
		$path_map = array();
101
		$this->single_manifest_handler->register_plugin_manifests(
102
			'vendor/composer/jetpack_autoload_psr4.php',
103
			$path_map
104
		);
105
106
		$loader = new Version_Loader(
107
			new Version_Selector(),
108
			null,
109
			$path_map,
110
			null
111
		);
112
113
		$file = $loader->find_class_file( Psr4Test::class );
114
115
		$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_current/src/Psr4/Test.php', $file );
116
	}
117
118
	/**
119
	 * Tests that the PSR-4 manifest from multiple plugins can be handled correctly.
@@ 121-138 (lines=18) @@
118
	/**
119
	 * Tests that the PSR-4 manifest from multiple plugins can be handled correctly.
120
	 */
121
	public function test_multiple_plugin_psr4() {
122
		$path_map = array();
123
		$this->multiple_manifest_handler->register_plugin_manifests(
124
			'vendor/composer/jetpack_autoload_psr4.php',
125
			$path_map
126
		);
127
128
		$loader = new Version_Loader(
129
			new Version_Selector(),
130
			null,
131
			$path_map,
132
			null
133
		);
134
135
		$file = $loader->find_class_file( Psr4Test::class );
136
137
		$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_newer/src/Psr4/Test.php', $file );
138
	}
139
140
	/**
141
	 * Tests that the filemap manifest from a single plugin can be handled correctly.