Skip to content

Commit 76ba861

Browse files
author
Vincent Langlet
committed
🚨 Add tests
1 parent baabad6 commit 76ba861

File tree

4 files changed

+124
-0
lines changed

4 files changed

+124
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
class myClass1
4+
{
5+
public function functionPublic1() {}
6+
7+
protected function functionProtected1() {}
8+
9+
public function functionPublic2() {}
10+
}
11+
12+
class myClass2
13+
{
14+
public function functionPublic1() {}
15+
16+
protected function functionProtected1() {}
17+
18+
private function functionPrivate() {}
19+
20+
protected function functionProtected2() {}
21+
}
22+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/**
4+
* Unit test class for the ScopeOrder sniff.
5+
*
6+
* A sniff unit test checks a .inc file for expected violations of a single
7+
* coding standard. Expected errors and warnings are stored in this class.
8+
*/
9+
class Symfony3Custom_Tests_Functions_ScopeOrderUnitTest extends AbstractSniffUnitTest
10+
{
11+
/**
12+
* Returns the lines where errors should occur.
13+
*
14+
* The key of the array should represent the line number and the value
15+
* should represent the number of errors that should occur on that line.
16+
*
17+
* @return array(int => int)
18+
*/
19+
public function getErrorList()
20+
{
21+
return array(
22+
9 => 1,
23+
20 => 1,
24+
);
25+
}
26+
27+
/**
28+
* Returns the lines where warnings should occur.
29+
*
30+
* The key of the array should represent the line number and the value
31+
* should represent the number of errors that should occur on that line.
32+
*
33+
* @return array(int => int)
34+
*/
35+
public function getWarningList()
36+
{
37+
return array();
38+
}
39+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
class myClass
4+
{
5+
function invalidFunction()
6+
{
7+
return;
8+
}
9+
10+
public function validPublicFunction()
11+
{
12+
return;
13+
}
14+
15+
protected function validProtectedFunction()
16+
{
17+
return;
18+
}
19+
20+
private function validPrivateFunction()
21+
{
22+
return;
23+
}
24+
}
25+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/**
4+
* Unit test class for the MethodScope sniff.
5+
*
6+
* A sniff unit test checks a .inc file for expected violations of a single
7+
* coding standard. Expected errors and warnings are stored in this class.
8+
*/
9+
class Symfony3Custom_Tests_Scope_MethodScopeUnitTest extends AbstractSniffUnitTest
10+
{
11+
/**
12+
* Returns the lines where errors should occur.
13+
*
14+
* The key of the array should represent the line number and the value
15+
* should represent the number of errors that should occur on that line.
16+
*
17+
* @return array(int => int)
18+
*/
19+
public function getErrorList()
20+
{
21+
return array(
22+
5 => 1,
23+
);
24+
}
25+
26+
/**
27+
* Returns the lines where warnings should occur.
28+
*
29+
* The key of the array should represent the line number and the value
30+
* should represent the number of errors that should occur on that line.
31+
*
32+
* @return array(int => int)
33+
*/
34+
public function getWarningList()
35+
{
36+
return array();
37+
}
38+
}

0 commit comments

Comments
 (0)