Completed
Pull Request — master (#208)
by Matthew
03:23
created

stringsTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 4
lcom 1
cbo 1
dl 46
loc 46
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 5 5 1
A tearDown() 3 3 1
A test_struname() 14 14 1
A test_stremail() 15 15 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3 View Code Duplication
class stringsTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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...
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
4
{
5
    private $e;
6
7
	public function setUp()
8
	{
9
10
		$this->e = new strings();
11
	}
12
13
	public function tearDown() {
14
        $this->e = NULL;
15
    }
16
17
    public function test_struname() {
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
18
        // Happy path
19
        $this->assertEquals($this->e->struname("this"), "This");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
20
        $this->assertEquals($this->e->struname("1this"), "1this");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
21
        $this->assertEquals($this->e->struname("This"), "This");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
22
        $this->assertEquals($this->e->struname("This "), "This");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
23
        $this->assertEquals($this->e->struname("This_"), "This");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
24
25
        // Sad Path
26
        $this->assertNotEquals($this->e->struname("This "), "This ");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
27
        $this->assertNotEquals($this->e->struname("This_"), "This_");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
28
        $this->assertNotEquals($this->e->struname("this"), "this");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
29
        $this->assertNotEquals($this->e->struname("1this"), "1This");
0 ignored issues
show
Deprecated Code introduced by
The method strings::struname() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
30
    }
31
32
    public function test_stremail() {
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
33
        $this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
34
        $this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
35
        $this->assertEquals($this->e->stremail(" [email protected]"), "[email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
36
        $this->assertEquals($this->e->stremail("[email protected] "), "[email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
37
        $this->assertEquals($this->e->stremail("1this12345 @example.com"), "[email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
38
        $this->assertEquals($this->e->stremail("1this12345@ example.com"), "[email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
39
40
        // Sad Path
41
        $this->assertNotEquals($this->e->stremail(" [email protected]"), " [email protected]");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
42
        $this->assertNotEquals($this->e->stremail("[email protected] "), "[email protected] ");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
43
        $this->assertNotEquals($this->e->stremail("1this12345 @example.com"), "1this12345 @example.com");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
44
        $this->assertNotEquals($this->e->stremail("1this12345@ example.com"), "1this12345@ example.com");
0 ignored issues
show
Deprecated Code introduced by
The method strings::stremail() has been deprecated with message: StringFunctions class

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
45
46
    }
47
48
}
49