File tree Expand file tree Collapse file tree 17 files changed +30
-27
lines changed
appengine/php72/getting-started/test Expand file tree Collapse file tree 17 files changed +30
-27
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ return PhpCsFixer\Config::create()
10
10
'method_argument_space ' => [
11
11
'keep_multiple_spaces_after_comma ' => true
12
12
],
13
+ 'return_type_declaration ' => [
14
+ 'space_before ' => 'none '
15
+ ],
13
16
])
14
17
->setFinder (
15
18
PhpCsFixer \Finder::create ()
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class CloudSqlTest extends TestCase
25
25
{
26
26
use TestTrait;
27
27
28
- public function setUp () : void
28
+ public function setUp (): void
29
29
{
30
30
$ connection = $ this ->requireEnv ('CLOUDSQL_CONNECTION_NAME ' );
31
31
$ dbUser = $ this ->requireEnv ('CLOUDSQL_USER ' );
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public function createTableIfNotExists()
68
68
*
69
69
* @return array
70
70
*/
71
- public function listVotes () : array
71
+ public function listVotes (): array
72
72
{
73
73
$ sql = "SELECT vote_value, time_cast FROM votes ORDER BY time_cast DESC LIMIT 5 " ;
74
74
$ statement = $ this ->connection ->prepare ($ sql );
@@ -82,7 +82,7 @@ public function listVotes() : array
82
82
* @param string $value
83
83
* @param int
84
84
*/
85
- public function getCountByValue (string $ value ) : int
85
+ public function getCountByValue (string $ value ): int
86
86
{
87
87
$ sql = "SELECT COUNT(vote_id) as voteCount FROM votes WHERE vote_value = ? " ;
88
88
@@ -98,7 +98,7 @@ public function getCountByValue(string $value) : int
98
98
* @param string $value The value to vote for.
99
99
* @return boolean
100
100
*/
101
- public function insertVote (string $ value ) : bool
101
+ public function insertVote (string $ value ): bool
102
102
{
103
103
$ conn = $ this ->connection ;
104
104
$ res = false ;
Original file line number Diff line number Diff line change 54
54
/**
55
55
* @param $conn_config array driver-specific options for PDO
56
56
*/
57
- function init_tcp_database_connection (array $ conn_config ) : PDO
57
+ function init_tcp_database_connection (array $ conn_config ): PDO
58
58
{
59
59
$ username = getenv ('DB_USER ' );
60
60
$ password = getenv ('DB_PASS ' );
@@ -107,7 +107,7 @@ function init_tcp_database_connection(array $conn_config) : PDO
107
107
/**
108
108
* @param $conn_config array driver-specific options for PDO
109
109
*/
110
- function init_unix_database_connection (array $ conn_config ) : PDO
110
+ function init_unix_database_connection (array $ conn_config ): PDO
111
111
{
112
112
$ username = getenv ('DB_USER ' );
113
113
$ password = getenv ('DB_PASS ' );
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class VotesTest extends TestCase
29
29
{
30
30
private $ conn ;
31
31
32
- public function setUp () : void
32
+ public function setUp (): void
33
33
{
34
34
$ this ->conn = $ this ->prophesize (PDO ::class);
35
35
}
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public function createTableIfNotExists()
68
68
*
69
69
* @return array
70
70
*/
71
- public function listVotes () : array
71
+ public function listVotes (): array
72
72
{
73
73
$ sql = "SELECT vote_value, time_cast FROM votes ORDER BY time_cast DESC LIMIT 5 " ;
74
74
$ statement = $ this ->connection ->prepare ($ sql );
@@ -82,7 +82,7 @@ public function listVotes() : array
82
82
* @param string $value
83
83
* @param int
84
84
*/
85
- public function getCountByValue (string $ value ) : int
85
+ public function getCountByValue (string $ value ): int
86
86
{
87
87
$ sql = "SELECT COUNT(vote_id) as voteCount FROM votes WHERE vote_value = ? " ;
88
88
@@ -98,7 +98,7 @@ public function getCountByValue(string $value) : int
98
98
* @param string $value The value to vote for.
99
99
* @return boolean
100
100
*/
101
- public function insertVote (string $ value ) : bool
101
+ public function insertVote (string $ value ): bool
102
102
{
103
103
$ conn = $ this ->connection ;
104
104
$ res = false ;
Original file line number Diff line number Diff line change 54
54
/**
55
55
* @param $conn_config array driver-specific options for PDO
56
56
*/
57
- function init_tcp_database_connection (array $ conn_config ) : PDO
57
+ function init_tcp_database_connection (array $ conn_config ): PDO
58
58
{
59
59
$ username = getenv ('DB_USER ' );
60
60
$ password = getenv ('DB_PASS ' );
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class VotesTest extends TestCase
29
29
{
30
30
private $ conn ;
31
31
32
- public function setUp () : void
32
+ public function setUp (): void
33
33
{
34
34
$ this ->conn = $ this ->prophesize (PDO ::class);
35
35
}
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public function createTableIfNotExists()
74
74
*
75
75
* @return array
76
76
*/
77
- public function listVotes () : array
77
+ public function listVotes (): array
78
78
{
79
79
$ sql = "SELECT TOP 5 vote_value, time_cast FROM votes ORDER BY time_cast DESC " ;
80
80
$ statement = $ this ->connection ->prepare ($ sql );
@@ -88,7 +88,7 @@ public function listVotes() : array
88
88
* @param string $value
89
89
* @param int
90
90
*/
91
- public function getCountByValue (string $ value ) : int
91
+ public function getCountByValue (string $ value ): int
92
92
{
93
93
$ sql = "SELECT COUNT(vote_id) as voteCount FROM votes WHERE vote_value = ? " ;
94
94
@@ -104,7 +104,7 @@ public function getCountByValue(string $value) : int
104
104
* @param string $value The value to vote for.
105
105
* @return boolean
106
106
*/
107
- public function insertVote (string $ value ) : bool
107
+ public function insertVote (string $ value ): bool
108
108
{
109
109
$ conn = $ this ->connection ;
110
110
$ res = false ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class VotesTest extends TestCase
29
29
{
30
30
private $ conn ;
31
31
32
- public function setUp () : void
32
+ public function setUp (): void
33
33
{
34
34
$ this ->conn = $ this ->prophesize (PDO ::class);
35
35
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class DeployTest extends TestCase
36
36
37
37
private static $ name = 'helloGet ' ;
38
38
39
- public function testFunction () : void
39
+ public function testFunction (): void
40
40
{
41
41
// Send a request to the function.
42
42
$ resp = $ this ->client ->get ('' , [
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class SystemTest extends TestCase
30
30
31
31
private static $ name = 'helloGet ' ;
32
32
33
- public function testFunction () : void
33
+ public function testFunction (): void
34
34
{
35
35
// Send a request to the function.
36
36
$ resp = $ this ->client ->get ('/ ' );
Original file line number Diff line number Diff line change @@ -28,19 +28,19 @@ class UnitTest extends TestCase
28
28
{
29
29
private static $ name = 'helloGet ' ;
30
30
31
- public static function setUpBeforeClass () : void
31
+ public static function setUpBeforeClass (): void
32
32
{
33
33
require_once __DIR__ . '/../index.php ' ;
34
34
}
35
35
36
- public function testFunction () : void
36
+ public function testFunction (): void
37
37
{
38
38
$ request = new ServerRequest ('GET ' , '/ ' );
39
39
$ output = $ this ->runFunction (self ::$ name , [$ request ]);
40
40
$ this ->assertContains ('Hello, World! ' , $ output );
41
41
}
42
42
43
- private static function runFunction ($ functionName , array $ params = []) : string
43
+ private static function runFunction ($ functionName , array $ params = []): string
44
44
{
45
45
return call_user_func_array ($ functionName , $ params );
46
46
}
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class DeployTest extends TestCase
37
37
38
38
private static $ name = 'helloHttp ' ;
39
39
40
- public function testFunction () : void
40
+ public function testFunction (): void
41
41
{
42
42
foreach (self ::cases () as $ test ) {
43
43
$ body = json_encode ($ test ['body ' ]);
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ class SystemTest extends TestCase
32
32
33
33
private static $ name = 'helloHttp ' ;
34
34
35
- public function testFunction () : void
35
+ public function testFunction (): void
36
36
{
37
37
foreach (self ::cases () as $ test ) {
38
38
$ body = json_encode ($ test ['body ' ]);
Original file line number Diff line number Diff line change 20
20
21
21
trait TestCasesTrait
22
22
{
23
- public static function cases () : array
23
+ public static function cases (): array
24
24
{
25
25
return [
26
26
[
Original file line number Diff line number Diff line change @@ -31,12 +31,12 @@ class UnitTest extends TestCase
31
31
32
32
private static $ name = 'helloHttp ' ;
33
33
34
- public static function setUpBeforeClass () : void
34
+ public static function setUpBeforeClass (): void
35
35
{
36
36
require_once __DIR__ . '/../index.php ' ;
37
37
}
38
38
39
- public function testFunction () : void
39
+ public function testFunction (): void
40
40
{
41
41
foreach (self ::cases () as $ test ) {
42
42
$ body = json_encode ($ test ['body ' ]);
@@ -47,7 +47,7 @@ public function testFunction() : void
47
47
}
48
48
}
49
49
50
- private static function runFunction ($ functionName , array $ params = []) : string
50
+ private static function runFunction ($ functionName , array $ params = []): string
51
51
{
52
52
return call_user_func_array ($ functionName , $ params );
53
53
}
You can’t perform that action at this time.
0 commit comments