Code Duplication    Length = 29-29 lines in 3 locations

packages/autoloader/tests/php/tests/unit/ManifestGeneratorTest.php 3 locations

@@ 28-56 (lines=29) @@
25
	/**
26
	 * Tests that manifests for classmaps are generated correctly.
27
	 */
28
	public function test_builds_classmap_manifest() {
29
		$expected = <<<EXPECTED_FILE
30
<?php
31
32
// This file `test-file.php` was auto generated by automattic/jetpack-autoloader.
33
34
\$vendorDir = dirname(__DIR__);
35
\$baseDir   = dirname(\$vendorDir);
36
37
return array(
38
	'TestFile' => array(
39
		'version' => '1.0.0.0',
40
		'path'    => \$vendorDir . '/path_to_file.php'
41
	),
42
);
43
44
EXPECTED_FILE;
45
46
		$content = array(
47
			'TestFile' => array(
48
				'path'    => '$vendorDir . \'/path_to_file.php\'',
49
				'version' => '1.0.0.0',
50
			),
51
		);
52
53
		$manifest = ManifestGenerator::buildManifest( 'classmap', 'test-file.php', $content );
54
55
		$this->assertEquals( $expected, $manifest );
56
	}
57
58
	/**
59
	 * Tests that manifests for PSR-4 are generated correctly.
@@ 61-89 (lines=29) @@
58
	/**
59
	 * Tests that manifests for PSR-4 are generated correctly.
60
	 */
61
	public function test_builds_psr_manifest() {
62
		$expected = <<<EXPECTED_FILE
63
<?php
64
65
// This file `test-file2.php` was auto generated by automattic/jetpack-autoloader.
66
67
\$vendorDir = dirname(__DIR__);
68
\$baseDir   = dirname(\$vendorDir);
69
70
return array(
71
	'Automattic\\\\Jetpack\\\\' => array(
72
		'version' => '1.0.0.0',
73
		'path'    => array( \$vendorDir . '/src' )
74
	),
75
);
76
77
EXPECTED_FILE;
78
79
		$content = array(
80
			'Automattic\\Jetpack\\' => array(
81
				'path'    => array( '$vendorDir . \'/src\'' ),
82
				'version' => '1.0.0.0',
83
			),
84
		);
85
86
		$manifest = ManifestGenerator::buildManifest( 'psr-4', 'test-file2.php', $content );
87
88
		$this->assertEquals( $expected, $manifest );
89
	}
90
91
	/**
92
	 * Tests that manifests for files are generated correctly.
@@ 94-122 (lines=29) @@
91
	/**
92
	 * Tests that manifests for files are generated correctly.
93
	 */
94
	public function test_builds_files_manifest() {
95
		$expected = <<<EXPECTED_FILE
96
<?php
97
98
// This file `test-file3.php` was auto generated by automattic/jetpack-autoloader.
99
100
\$vendorDir = dirname(__DIR__);
101
\$baseDir   = dirname(\$vendorDir);
102
103
return array(
104
	'123d5a6s7vd' => array(
105
		'version' => '1.0.0.0',
106
		'path'    => \$vendorDir . '/path_to_file.php'
107
	),
108
);
109
110
EXPECTED_FILE;
111
112
		$content = array(
113
			'123d5a6s7vd' => array(
114
				'path'    => '$vendorDir . \'/path_to_file.php\'',
115
				'version' => '1.0.0.0',
116
			),
117
		);
118
119
		$manifest = ManifestGenerator::buildManifest( 'files', 'test-file3.php', $content );
120
121
		$this->assertEquals( $expected, $manifest );
122
	}
123
}
124