Code Duplication    Length = 28-28 lines in 3 locations

projects/packages/autoloader/tests/php/tests/integration/LoadingGeneratedManifestsTest.php 3 locations

@@ 54-81 (lines=28) @@
51
	/**
52
	 * Tests that the classmap manifest we generate can be read by the handler.
53
	 */
54
	public function test_that_handler_reads_classmap_manifests() {
55
		$this->write_test_manifest(
56
			'classmap',
57
			array(
58
				'TestFile' => array(
59
					'path'    => '$baseDir . \'/path_to_file.php\'',
60
					'version' => '1.0.0.0',
61
				),
62
			)
63
		);
64
65
		$loaded = array();
66
		$this->manifest_handler->read_manifests(
67
			array( TEST_PLUGIN_DIR ),
68
			self::TEST_MANIFEST_PATH,
69
			$loaded
70
		);
71
72
		$this->assertEquals(
73
			array(
74
				'TestFile' => array(
75
					'version' => '1.0.0.0',
76
					'path'    => TEST_PLUGIN_DIR . '/path_to_file.php',
77
				),
78
			),
79
			$loaded
80
		);
81
	}
82
83
	/**
84
	 * Tests that the PSR-4 manifest we generate can be read by the handler.
@@ 86-113 (lines=28) @@
83
	/**
84
	 * Tests that the PSR-4 manifest we generate can be read by the handler.
85
	 */
86
	public function test_that_handler_reads_psr4_manifests() {
87
		$this->write_test_manifest(
88
			'psr-4',
89
			array(
90
				'Automattic\\Jetpack\\' => array(
91
					'path'    => array( '$baseDir . \'/src\'' ),
92
					'version' => '1.2.0.0',
93
				),
94
			)
95
		);
96
97
		$loaded = array();
98
		$this->manifest_handler->read_manifests(
99
			array( TEST_PLUGIN_DIR ),
100
			self::TEST_MANIFEST_PATH,
101
			$loaded
102
		);
103
104
		$this->assertEquals(
105
			array(
106
				'Automattic\\Jetpack\\' => array(
107
					'version' => '1.2.0.0',
108
					'path'    => array( TEST_PLUGIN_DIR . '/src' ),
109
				),
110
			),
111
			$loaded
112
		);
113
	}
114
115
	/**
116
	 * Tests that the files manifest we generate can be read by the handler.
@@ 118-145 (lines=28) @@
115
	/**
116
	 * Tests that the files manifest we generate can be read by the handler.
117
	 */
118
	public function test_that_handler_reads_files_manifests() {
119
		$this->write_test_manifest(
120
			'files',
121
			array(
122
				'123d5a6s7vd' => array(
123
					'path'    => '$baseDir . \'/path_to_file.php\'',
124
					'version' => '1.3.0.0',
125
				),
126
			)
127
		);
128
129
		$loaded = array();
130
		$this->manifest_handler->read_manifests(
131
			array( TEST_PLUGIN_DIR ),
132
			self::TEST_MANIFEST_PATH,
133
			$loaded
134
		);
135
136
		$this->assertEquals(
137
			array(
138
				'123d5a6s7vd' => array(
139
					'version' => '1.3.0.0',
140
					'path'    => TEST_PLUGIN_DIR . '/path_to_file.php',
141
				),
142
			),
143
			$loaded
144
		);
145
	}
146
147
	/**
148
	 * Writes the test manifest for the tests to use.