Code Duplication    Length = 21-25 lines in 2 locations

tests/forms/RequirementsTest.php 2 locations

@@ 153-173 (lines=21) @@
150
        );
151
    }
152
153
    public function testCustomType() {
154
		/** @var Requirements_Backend $backend */
155
		$backend = Injector::inst()->create('SilverStripe\\View\\Requirements_Backend');
156
		$basePath = $this->getCurrentRelativePath();
157
		$this->setupRequirements($backend);
158
159
		// require files normally (e.g. called from a FormField instance)
160
		$backend->javascript($basePath . '/RequirementsTest_a.js', [
161
			'type' => 'application/json'
162
		]);
163
		$backend->javascript($basePath . '/RequirementsTest_b.js');
164
		$result = $backend->includeInHTML(self::$html_template);
165
		$this->assertRegexp(
166
			'#<script type="application/json" src=".*/tests/forms/RequirementsTest_a.js#',
167
			$result
168
		);
169
		$this->assertRegexp(
170
			'#<script type="application/javascript" src=".*/tests/forms/RequirementsTest_b.js#',
171
			$result
172
		);
173
	}
174
175
	public function testCombinedJavascript() {
176
		/** @var Requirements_Backend $backend */
@@ 522-546 (lines=25) @@
519
		);
520
	}
521
522
	public function testArgsInUrls() {
523
		$basePath = $this->getCurrentRelativePath();
524
525
		/** @var Requirements_Backend $backend */
526
		$backend = Injector::inst()->create('SilverStripe\\View\\Requirements_Backend');
527
		$this->setupRequirements($backend);
528
529
		$backend->javascript($basePath . '/RequirementsTest_a.js?test=1&test=2&test=3');
530
		$backend->css($basePath . '/RequirementsTest_a.css?test=1&test=2&test=3');
531
		$html = $backend->includeInHTML(self::$html_template);
532
533
		/* Javascript has correct path */
534
		$this->assertRegExp(
535
			'/src=".*\/RequirementsTest_a\.js\?m=\d\d+&amp;test=1&amp;test=2&amp;test=3/',
536
			$html,
537
			'javascript has correct path'
538
		);
539
540
		/* CSS has correct path */
541
		$this->assertRegExp(
542
			'/href=".*\/RequirementsTest_a\.css\?m=\d\d+&amp;test=1&amp;test=2&amp;test=3/',
543
			$html,
544
			'css has correct path'
545
		);
546
	}
547
548
	public function testRequirementsBackend() {
549
		$basePath = $this->getCurrentRelativePath();