@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | class ThrowExceptionTestCase extends TestCase |
5 | 5 | { |
6 | - public function test() |
|
7 | - { |
|
8 | - throw new RuntimeException('A runtime error occurred'); |
|
9 | - } |
|
6 | + public function test() |
|
7 | + { |
|
8 | + throw new RuntimeException('A runtime error occurred'); |
|
9 | + } |
|
10 | 10 | } |
@@ -17,64 +17,64 @@ |
||
17 | 17 | */ |
18 | 18 | class BankAccount |
19 | 19 | { |
20 | - /** |
|
21 | - * The bank account's balance. |
|
22 | - * |
|
23 | - * @var float |
|
24 | - */ |
|
25 | - protected $balance = 0; |
|
20 | + /** |
|
21 | + * The bank account's balance. |
|
22 | + * |
|
23 | + * @var float |
|
24 | + */ |
|
25 | + protected $balance = 0; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Returns the bank account's balance. |
|
29 | - * |
|
30 | - * @return float |
|
31 | - */ |
|
32 | - public function getBalance() |
|
33 | - { |
|
34 | - return $this->balance; |
|
35 | - } |
|
27 | + /** |
|
28 | + * Returns the bank account's balance. |
|
29 | + * |
|
30 | + * @return float |
|
31 | + */ |
|
32 | + public function getBalance() |
|
33 | + { |
|
34 | + return $this->balance; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Sets the bank account's balance. |
|
39 | - * |
|
40 | - * @param float $balance |
|
41 | - * |
|
42 | - * @throws BankAccountException |
|
43 | - */ |
|
44 | - protected function setBalance($balance) |
|
45 | - { |
|
46 | - if ($balance >= 0) { |
|
47 | - $this->balance = $balance; |
|
48 | - } else { |
|
49 | - throw new BankAccountException; |
|
50 | - } |
|
51 | - } |
|
37 | + /** |
|
38 | + * Sets the bank account's balance. |
|
39 | + * |
|
40 | + * @param float $balance |
|
41 | + * |
|
42 | + * @throws BankAccountException |
|
43 | + */ |
|
44 | + protected function setBalance($balance) |
|
45 | + { |
|
46 | + if ($balance >= 0) { |
|
47 | + $this->balance = $balance; |
|
48 | + } else { |
|
49 | + throw new BankAccountException; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Deposits an amount of money to the bank account. |
|
55 | - * |
|
56 | - * @param float $balance |
|
57 | - * |
|
58 | - * @throws BankAccountException |
|
59 | - */ |
|
60 | - public function depositMoney($balance) |
|
61 | - { |
|
62 | - $this->setBalance($this->getBalance() + $balance); |
|
53 | + /** |
|
54 | + * Deposits an amount of money to the bank account. |
|
55 | + * |
|
56 | + * @param float $balance |
|
57 | + * |
|
58 | + * @throws BankAccountException |
|
59 | + */ |
|
60 | + public function depositMoney($balance) |
|
61 | + { |
|
62 | + $this->setBalance($this->getBalance() + $balance); |
|
63 | 63 | |
64 | - return $this->getBalance(); |
|
65 | - } |
|
64 | + return $this->getBalance(); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Withdraws an amount of money from the bank account. |
|
69 | - * |
|
70 | - * @param float $balance |
|
71 | - * |
|
72 | - * @throws BankAccountException |
|
73 | - */ |
|
74 | - public function withdrawMoney($balance) |
|
75 | - { |
|
76 | - $this->setBalance($this->getBalance() - $balance); |
|
67 | + /** |
|
68 | + * Withdraws an amount of money from the bank account. |
|
69 | + * |
|
70 | + * @param float $balance |
|
71 | + * |
|
72 | + * @throws BankAccountException |
|
73 | + */ |
|
74 | + public function withdrawMoney($balance) |
|
75 | + { |
|
76 | + $this->setBalance($this->getBalance() - $balance); |
|
77 | 77 | |
78 | - return $this->getBalance(); |
|
79 | - } |
|
78 | + return $this->getBalance(); |
|
79 | + } |
|
80 | 80 | } |
@@ -6,37 +6,37 @@ |
||
6 | 6 | |
7 | 7 | class StatusTest extends TestCase |
8 | 8 | { |
9 | - public function testSuccess() |
|
10 | - { |
|
11 | - $this->assertTrue(true); |
|
12 | - } |
|
13 | - |
|
14 | - public function testFailure() |
|
15 | - { |
|
16 | - $this->assertTrue(false); |
|
17 | - } |
|
18 | - |
|
19 | - public function testError() |
|
20 | - { |
|
21 | - throw new \RuntimeException; |
|
22 | - } |
|
23 | - |
|
24 | - public function testIncomplete() |
|
25 | - { |
|
26 | - $this->markTestIncomplete(); |
|
27 | - } |
|
28 | - |
|
29 | - public function testSkipped() |
|
30 | - { |
|
31 | - $this->markTestSkipped(); |
|
32 | - } |
|
33 | - |
|
34 | - public function testRisky() |
|
35 | - { |
|
36 | - } |
|
37 | - |
|
38 | - public function testWarning() |
|
39 | - { |
|
40 | - throw new Warning; |
|
41 | - } |
|
9 | + public function testSuccess() |
|
10 | + { |
|
11 | + $this->assertTrue(true); |
|
12 | + } |
|
13 | + |
|
14 | + public function testFailure() |
|
15 | + { |
|
16 | + $this->assertTrue(false); |
|
17 | + } |
|
18 | + |
|
19 | + public function testError() |
|
20 | + { |
|
21 | + throw new \RuntimeException; |
|
22 | + } |
|
23 | + |
|
24 | + public function testIncomplete() |
|
25 | + { |
|
26 | + $this->markTestIncomplete(); |
|
27 | + } |
|
28 | + |
|
29 | + public function testSkipped() |
|
30 | + { |
|
31 | + $this->markTestSkipped(); |
|
32 | + } |
|
33 | + |
|
34 | + public function testRisky() |
|
35 | + { |
|
36 | + } |
|
37 | + |
|
38 | + public function testWarning() |
|
39 | + { |
|
40 | + throw new Warning; |
|
41 | + } |
|
42 | 42 | } |
@@ -3,139 +3,139 @@ |
||
3 | 3 | |
4 | 4 | class ExceptionTest extends TestCase |
5 | 5 | { |
6 | - /** |
|
7 | - * Exception message |
|
8 | - * |
|
9 | - * @var string |
|
10 | - */ |
|
11 | - const ERROR_MESSAGE = 'Exception message'; |
|
12 | - |
|
13 | - /** |
|
14 | - * Exception message |
|
15 | - * |
|
16 | - * @var string |
|
17 | - */ |
|
18 | - const ERROR_MESSAGE_REGEX = '#regex#'; |
|
19 | - |
|
20 | - /** |
|
21 | - * Exception code |
|
22 | - * |
|
23 | - * @var int |
|
24 | - */ |
|
25 | - const ERROR_CODE = 500; |
|
26 | - |
|
27 | - /** |
|
28 | - * @expectedException FooBarBaz |
|
29 | - */ |
|
30 | - public function testOne() |
|
31 | - { |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * @expectedException Foo_Bar_Baz |
|
36 | - */ |
|
37 | - public function testTwo() |
|
38 | - { |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * @expectedException Foo\Bar\Baz |
|
43 | - */ |
|
44 | - public function testThree() |
|
45 | - { |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * @expectedException ほげ |
|
50 | - */ |
|
51 | - public function testFour() |
|
52 | - { |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * @expectedException Class Message 1234 |
|
57 | - */ |
|
58 | - public function testFive() |
|
59 | - { |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @expectedException Class |
|
64 | - * @expectedExceptionMessage Message |
|
65 | - * @expectedExceptionCode 1234 |
|
66 | - */ |
|
67 | - public function testSix() |
|
68 | - { |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @expectedException Class |
|
73 | - * @expectedExceptionMessage Message |
|
74 | - * @expectedExceptionCode ExceptionCode |
|
75 | - */ |
|
76 | - public function testSeven() |
|
77 | - { |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * @expectedException Class |
|
82 | - * @expectedExceptionMessage Message |
|
83 | - * @expectedExceptionCode 0 |
|
84 | - */ |
|
85 | - public function testEight() |
|
86 | - { |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @expectedException Class |
|
91 | - * @expectedExceptionMessage ExceptionTest::ERROR_MESSAGE |
|
92 | - * @expectedExceptionCode ExceptionTest::ERROR_CODE |
|
93 | - */ |
|
94 | - public function testNine() |
|
95 | - { |
|
96 | - } |
|
97 | - |
|
98 | - /** @expectedException Class */ |
|
99 | - public function testSingleLine() |
|
100 | - { |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * @expectedException Class |
|
105 | - * @expectedExceptionCode ExceptionTest::UNKNOWN_CODE_CONSTANT |
|
106 | - * @expectedExceptionMessage ExceptionTest::UNKNOWN_MESSAGE_CONSTANT |
|
107 | - */ |
|
108 | - public function testUnknownConstants() |
|
109 | - { |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @expectedException Class |
|
114 | - * @expectedExceptionCode 1234 |
|
115 | - * @expectedExceptionMessage Message |
|
116 | - * @expectedExceptionMessageRegExp #regex# |
|
117 | - */ |
|
118 | - public function testWithRegexMessage() |
|
119 | - { |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @expectedException Class |
|
124 | - * @expectedExceptionCode 1234 |
|
125 | - * @expectedExceptionMessage Message |
|
126 | - * @expectedExceptionMessageRegExp ExceptionTest::ERROR_MESSAGE_REGEX |
|
127 | - */ |
|
128 | - public function testWithRegexMessageFromClassConstant() |
|
129 | - { |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @expectedException Class |
|
134 | - * @expectedExceptionCode 1234 |
|
135 | - * @expectedExceptionMessage Message |
|
136 | - * @expectedExceptionMessageRegExp ExceptionTest::UNKNOWN_MESSAGE_REGEX_CONSTANT |
|
137 | - */ |
|
138 | - public function testWithUnknowRegexMessageFromClassConstant() |
|
139 | - { |
|
140 | - } |
|
6 | + /** |
|
7 | + * Exception message |
|
8 | + * |
|
9 | + * @var string |
|
10 | + */ |
|
11 | + const ERROR_MESSAGE = 'Exception message'; |
|
12 | + |
|
13 | + /** |
|
14 | + * Exception message |
|
15 | + * |
|
16 | + * @var string |
|
17 | + */ |
|
18 | + const ERROR_MESSAGE_REGEX = '#regex#'; |
|
19 | + |
|
20 | + /** |
|
21 | + * Exception code |
|
22 | + * |
|
23 | + * @var int |
|
24 | + */ |
|
25 | + const ERROR_CODE = 500; |
|
26 | + |
|
27 | + /** |
|
28 | + * @expectedException FooBarBaz |
|
29 | + */ |
|
30 | + public function testOne() |
|
31 | + { |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * @expectedException Foo_Bar_Baz |
|
36 | + */ |
|
37 | + public function testTwo() |
|
38 | + { |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * @expectedException Foo\Bar\Baz |
|
43 | + */ |
|
44 | + public function testThree() |
|
45 | + { |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * @expectedException ほげ |
|
50 | + */ |
|
51 | + public function testFour() |
|
52 | + { |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * @expectedException Class Message 1234 |
|
57 | + */ |
|
58 | + public function testFive() |
|
59 | + { |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @expectedException Class |
|
64 | + * @expectedExceptionMessage Message |
|
65 | + * @expectedExceptionCode 1234 |
|
66 | + */ |
|
67 | + public function testSix() |
|
68 | + { |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @expectedException Class |
|
73 | + * @expectedExceptionMessage Message |
|
74 | + * @expectedExceptionCode ExceptionCode |
|
75 | + */ |
|
76 | + public function testSeven() |
|
77 | + { |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * @expectedException Class |
|
82 | + * @expectedExceptionMessage Message |
|
83 | + * @expectedExceptionCode 0 |
|
84 | + */ |
|
85 | + public function testEight() |
|
86 | + { |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @expectedException Class |
|
91 | + * @expectedExceptionMessage ExceptionTest::ERROR_MESSAGE |
|
92 | + * @expectedExceptionCode ExceptionTest::ERROR_CODE |
|
93 | + */ |
|
94 | + public function testNine() |
|
95 | + { |
|
96 | + } |
|
97 | + |
|
98 | + /** @expectedException Class */ |
|
99 | + public function testSingleLine() |
|
100 | + { |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * @expectedException Class |
|
105 | + * @expectedExceptionCode ExceptionTest::UNKNOWN_CODE_CONSTANT |
|
106 | + * @expectedExceptionMessage ExceptionTest::UNKNOWN_MESSAGE_CONSTANT |
|
107 | + */ |
|
108 | + public function testUnknownConstants() |
|
109 | + { |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @expectedException Class |
|
114 | + * @expectedExceptionCode 1234 |
|
115 | + * @expectedExceptionMessage Message |
|
116 | + * @expectedExceptionMessageRegExp #regex# |
|
117 | + */ |
|
118 | + public function testWithRegexMessage() |
|
119 | + { |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @expectedException Class |
|
124 | + * @expectedExceptionCode 1234 |
|
125 | + * @expectedExceptionMessage Message |
|
126 | + * @expectedExceptionMessageRegExp ExceptionTest::ERROR_MESSAGE_REGEX |
|
127 | + */ |
|
128 | + public function testWithRegexMessageFromClassConstant() |
|
129 | + { |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @expectedException Class |
|
134 | + * @expectedExceptionCode 1234 |
|
135 | + * @expectedExceptionMessage Message |
|
136 | + * @expectedExceptionMessageRegExp ExceptionTest::UNKNOWN_MESSAGE_REGEX_CONSTANT |
|
137 | + */ |
|
138 | + public function testWithUnknowRegexMessageFromClassConstant() |
|
139 | + { |
|
140 | + } |
|
141 | 141 | } |
@@ -1,35 +1,35 @@ |
||
1 | 1 | <?php |
2 | 2 | class TestIterator2 implements Iterator |
3 | 3 | { |
4 | - protected $data; |
|
4 | + protected $data; |
|
5 | 5 | |
6 | - public function __construct(array $array) |
|
7 | - { |
|
8 | - $this->data = $array; |
|
9 | - } |
|
6 | + public function __construct(array $array) |
|
7 | + { |
|
8 | + $this->data = $array; |
|
9 | + } |
|
10 | 10 | |
11 | - public function current() |
|
12 | - { |
|
13 | - return current($this->data); |
|
14 | - } |
|
11 | + public function current() |
|
12 | + { |
|
13 | + return current($this->data); |
|
14 | + } |
|
15 | 15 | |
16 | - public function next() |
|
17 | - { |
|
18 | - next($this->data); |
|
19 | - } |
|
16 | + public function next() |
|
17 | + { |
|
18 | + next($this->data); |
|
19 | + } |
|
20 | 20 | |
21 | - public function key() |
|
22 | - { |
|
23 | - return key($this->data); |
|
24 | - } |
|
21 | + public function key() |
|
22 | + { |
|
23 | + return key($this->data); |
|
24 | + } |
|
25 | 25 | |
26 | - public function valid() |
|
27 | - { |
|
28 | - return key($this->data) !== null; |
|
29 | - } |
|
26 | + public function valid() |
|
27 | + { |
|
28 | + return key($this->data) !== null; |
|
29 | + } |
|
30 | 30 | |
31 | - public function rewind() |
|
32 | - { |
|
33 | - reset($this->data); |
|
34 | - } |
|
31 | + public function rewind() |
|
32 | + { |
|
33 | + reset($this->data); |
|
34 | + } |
|
35 | 35 | } |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | class Calculator |
3 | 3 | { |
4 | - /** |
|
5 | - * @assert (0, 0) == 0 |
|
6 | - * @assert (0, 1) == 1 |
|
7 | - * @assert (1, 0) == 1 |
|
8 | - * @assert (1, 1) == 2 |
|
9 | - */ |
|
10 | - public function add($a, $b) |
|
11 | - { |
|
12 | - return $a + $b; |
|
13 | - } |
|
4 | + /** |
|
5 | + * @assert (0, 0) == 0 |
|
6 | + * @assert (0, 1) == 1 |
|
7 | + * @assert (1, 0) == 1 |
|
8 | + * @assert (1, 1) == 2 |
|
9 | + */ |
|
10 | + public function add($a, $b) |
|
11 | + { |
|
12 | + return $a + $b; |
|
13 | + } |
|
14 | 14 | } |
@@ -3,24 +3,24 @@ |
||
3 | 3 | |
4 | 4 | class StackTest extends TestCase |
5 | 5 | { |
6 | - public function testPush() |
|
7 | - { |
|
8 | - $stack = []; |
|
9 | - $this->assertCount(0, $stack); |
|
6 | + public function testPush() |
|
7 | + { |
|
8 | + $stack = []; |
|
9 | + $this->assertCount(0, $stack); |
|
10 | 10 | |
11 | - $stack[] = 'foo'; |
|
12 | - $this->assertEquals('foo', end($stack)); |
|
13 | - $this->assertCount(1, $stack); |
|
11 | + $stack[] = 'foo'; |
|
12 | + $this->assertEquals('foo', end($stack)); |
|
13 | + $this->assertCount(1, $stack); |
|
14 | 14 | |
15 | - return $stack; |
|
16 | - } |
|
15 | + return $stack; |
|
16 | + } |
|
17 | 17 | |
18 | - /** |
|
19 | - * @depends testPush |
|
20 | - */ |
|
21 | - public function testPop(array $stack) |
|
22 | - { |
|
23 | - $this->assertEquals('foo', array_pop($stack)); |
|
24 | - $this->assertCount(0, $stack); |
|
25 | - } |
|
18 | + /** |
|
19 | + * @depends testPush |
|
20 | + */ |
|
21 | + public function testPop(array $stack) |
|
22 | + { |
|
23 | + $this->assertEquals('foo', array_pop($stack)); |
|
24 | + $this->assertCount(0, $stack); |
|
25 | + } |
|
26 | 26 | } |
@@ -3,36 +3,36 @@ |
||
3 | 3 | |
4 | 4 | class CoveredParentClass |
5 | 5 | { |
6 | - private function privateMethod() |
|
7 | - { |
|
8 | - } |
|
6 | + private function privateMethod() |
|
7 | + { |
|
8 | + } |
|
9 | 9 | |
10 | - protected function protectedMethod() |
|
11 | - { |
|
12 | - $this->privateMethod(); |
|
13 | - } |
|
10 | + protected function protectedMethod() |
|
11 | + { |
|
12 | + $this->privateMethod(); |
|
13 | + } |
|
14 | 14 | |
15 | - public function publicMethod() |
|
16 | - { |
|
17 | - $this->protectedMethod(); |
|
18 | - } |
|
15 | + public function publicMethod() |
|
16 | + { |
|
17 | + $this->protectedMethod(); |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | class CoveredClass extends CoveredParentClass |
22 | 22 | { |
23 | - private function privateMethod() |
|
24 | - { |
|
25 | - } |
|
23 | + private function privateMethod() |
|
24 | + { |
|
25 | + } |
|
26 | 26 | |
27 | - protected function protectedMethod() |
|
28 | - { |
|
29 | - parent::protectedMethod(); |
|
30 | - $this->privateMethod(); |
|
31 | - } |
|
27 | + protected function protectedMethod() |
|
28 | + { |
|
29 | + parent::protectedMethod(); |
|
30 | + $this->privateMethod(); |
|
31 | + } |
|
32 | 32 | |
33 | - public function publicMethod() |
|
34 | - { |
|
35 | - parent::publicMethod(); |
|
36 | - $this->protectedMethod(); |
|
37 | - } |
|
33 | + public function publicMethod() |
|
34 | + { |
|
35 | + parent::publicMethod(); |
|
36 | + $this->protectedMethod(); |
|
37 | + } |
|
38 | 38 | } |
@@ -2,21 +2,21 @@ |
||
2 | 2 | |
3 | 3 | class WrapperIteratorAggregate implements IteratorAggregate |
4 | 4 | { |
5 | - /** |
|
6 | - * @var array|\Traversable |
|
7 | - */ |
|
8 | - private $baseCollection; |
|
5 | + /** |
|
6 | + * @var array|\Traversable |
|
7 | + */ |
|
8 | + private $baseCollection; |
|
9 | 9 | |
10 | - public function __construct($baseCollection) |
|
11 | - { |
|
12 | - assert(is_array($baseCollection) || $baseCollection instanceof Traversable); |
|
13 | - $this->baseCollection = $baseCollection; |
|
14 | - } |
|
10 | + public function __construct($baseCollection) |
|
11 | + { |
|
12 | + assert(is_array($baseCollection) || $baseCollection instanceof Traversable); |
|
13 | + $this->baseCollection = $baseCollection; |
|
14 | + } |
|
15 | 15 | |
16 | - public function getIterator() |
|
17 | - { |
|
18 | - foreach ($this->baseCollection as $k => $v) { |
|
19 | - yield $k => $v; |
|
20 | - } |
|
21 | - } |
|
16 | + public function getIterator() |
|
17 | + { |
|
18 | + foreach ($this->baseCollection as $k => $v) { |
|
19 | + yield $k => $v; |
|
20 | + } |
|
21 | + } |
|
22 | 22 | } |