Code Duplication    Length = 28-28 lines in 3 locations

packages/autoloader/tests/php/tests/integration/test-loading-generated-manifests.php 3 locations

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