Completed
Pull Request — master (#513)
by Helpful
04:05
created

DNProjectRepositoryInterfaceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 37
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testURLParsing() 0 33 3
1
<?php
2
3
class DNProjectRepositoryInterfaceTest extends DeploynautTest {
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
5
	public function testURLParsing() {
6
		$shouldMatchURLs = array(
7
			'https://github.com/silverstripe/deploynaut.git',
8
			'github.com:silverstripe/deploynaut.git',
9
			'[email protected]:silverstripe/deploynaut.git',
10
			'ssh://[email protected]:22/silverstripe/deploynaut.git'
11
		);
12
13
		$project = new DNProject();
14
15
		foreach($shouldMatchURLs as $url) {
16
			$project->CVSPath = $url;
17
			$repositoryInterface = $project->getRepositoryInterface();
18
19
			$this->assertEquals(
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DNProjectRepositoryInterfaceTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
				'https://github.com/silverstripe/deploynaut',
21
				$repositoryInterface->URL,
22
				"Failed to extract repository from " . $url
23
			);
24
		}
25
26
		$shouldntMatchURLs = array(
27
			'https://othersite.com/github.com/ranking'
28
		);
29
30
		foreach($shouldntMatchURLs as $url) {
31
			$project->CVSPath = $url;
32
			$repositoryInterface = $project->getRepositoryInterface();
33
34
			$this->assertNull($repositoryInterface);
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<DNProjectRepositoryInterfaceTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
		}
36
37
	}
38
39
}