@@ -4,23 +4,23 @@ |
||
4 | 4 | |
5 | 5 | class ExceptionStackTest extends TestCase |
6 | 6 | { |
7 | - public function testPrintingChildException() |
|
8 | - { |
|
9 | - try { |
|
10 | - $this->assertEquals([1], [2], 'message'); |
|
11 | - } catch (ExpectationFailedException $e) { |
|
12 | - $message = $e->getMessage() . $e->getComparisonFailure()->getDiff(); |
|
7 | + public function testPrintingChildException() |
|
8 | + { |
|
9 | + try { |
|
10 | + $this->assertEquals([1], [2], 'message'); |
|
11 | + } catch (ExpectationFailedException $e) { |
|
12 | + $message = $e->getMessage() . $e->getComparisonFailure()->getDiff(); |
|
13 | 13 | |
14 | - throw new PHPUnit\Framework\Exception("Child exception\n$message", 101, $e); |
|
15 | - } |
|
16 | - } |
|
14 | + throw new PHPUnit\Framework\Exception("Child exception\n$message", 101, $e); |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - public function testNestedExceptions() |
|
19 | - { |
|
20 | - $exceptionThree = new Exception('Three'); |
|
21 | - $exceptionTwo = new InvalidArgumentException('Two', 0, $exceptionThree); |
|
22 | - $exceptionOne = new Exception('One', 0, $exceptionTwo); |
|
18 | + public function testNestedExceptions() |
|
19 | + { |
|
20 | + $exceptionThree = new Exception('Three'); |
|
21 | + $exceptionTwo = new InvalidArgumentException('Two', 0, $exceptionThree); |
|
22 | + $exceptionOne = new Exception('One', 0, $exceptionTwo); |
|
23 | 23 | |
24 | - throw $exceptionOne; |
|
25 | - } |
|
24 | + throw $exceptionOne; |
|
25 | + } |
|
26 | 26 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | try { |
10 | 10 | $this->assertEquals([1], [2], 'message'); |
11 | 11 | } catch (ExpectationFailedException $e) { |
12 | - $message = $e->getMessage() . $e->getComparisonFailure()->getDiff(); |
|
12 | + $message = $e->getMessage().$e->getComparisonFailure()->getDiff(); |
|
13 | 13 | |
14 | 14 | throw new PHPUnit\Framework\Exception("Child exception\n$message", 101, $e); |
15 | 15 | } |
@@ -3,35 +3,35 @@ |
||
3 | 3 | |
4 | 4 | class BeforeClassAndAfterClassTest extends TestCase |
5 | 5 | { |
6 | - public static $beforeClassWasRun = 0; |
|
7 | - public static $afterClassWasRun = 0; |
|
6 | + public static $beforeClassWasRun = 0; |
|
7 | + public static $afterClassWasRun = 0; |
|
8 | 8 | |
9 | - public static function resetProperties() |
|
10 | - { |
|
11 | - self::$beforeClassWasRun = 0; |
|
12 | - self::$afterClassWasRun = 0; |
|
13 | - } |
|
9 | + public static function resetProperties() |
|
10 | + { |
|
11 | + self::$beforeClassWasRun = 0; |
|
12 | + self::$afterClassWasRun = 0; |
|
13 | + } |
|
14 | 14 | |
15 | - /** |
|
16 | - * @beforeClass |
|
17 | - */ |
|
18 | - public static function initialClassSetup() |
|
19 | - { |
|
20 | - self::$beforeClassWasRun++; |
|
21 | - } |
|
15 | + /** |
|
16 | + * @beforeClass |
|
17 | + */ |
|
18 | + public static function initialClassSetup() |
|
19 | + { |
|
20 | + self::$beforeClassWasRun++; |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * @afterClass |
|
25 | - */ |
|
26 | - public static function finalClassTeardown() |
|
27 | - { |
|
28 | - self::$afterClassWasRun++; |
|
29 | - } |
|
23 | + /** |
|
24 | + * @afterClass |
|
25 | + */ |
|
26 | + public static function finalClassTeardown() |
|
27 | + { |
|
28 | + self::$afterClassWasRun++; |
|
29 | + } |
|
30 | 30 | |
31 | - public function test1() |
|
32 | - { |
|
33 | - } |
|
34 | - public function test2() |
|
35 | - { |
|
36 | - } |
|
31 | + public function test1() |
|
32 | + { |
|
33 | + } |
|
34 | + public function test2() |
|
35 | + { |
|
36 | + } |
|
37 | 37 | } |
@@ -3,35 +3,35 @@ |
||
3 | 3 | |
4 | 4 | class ExceptionInTest extends TestCase |
5 | 5 | { |
6 | - public $setUp = false; |
|
7 | - public $assertPreConditions = false; |
|
8 | - public $assertPostConditions = false; |
|
9 | - public $tearDown = false; |
|
10 | - public $testSomething = false; |
|
6 | + public $setUp = false; |
|
7 | + public $assertPreConditions = false; |
|
8 | + public $assertPostConditions = false; |
|
9 | + public $tearDown = false; |
|
10 | + public $testSomething = false; |
|
11 | 11 | |
12 | - protected function setUp() |
|
13 | - { |
|
14 | - $this->setUp = true; |
|
15 | - } |
|
12 | + protected function setUp() |
|
13 | + { |
|
14 | + $this->setUp = true; |
|
15 | + } |
|
16 | 16 | |
17 | - protected function assertPreConditions() |
|
18 | - { |
|
19 | - $this->assertPreConditions = true; |
|
20 | - } |
|
17 | + protected function assertPreConditions() |
|
18 | + { |
|
19 | + $this->assertPreConditions = true; |
|
20 | + } |
|
21 | 21 | |
22 | - public function testSomething() |
|
23 | - { |
|
24 | - $this->testSomething = true; |
|
25 | - throw new Exception; |
|
26 | - } |
|
22 | + public function testSomething() |
|
23 | + { |
|
24 | + $this->testSomething = true; |
|
25 | + throw new Exception; |
|
26 | + } |
|
27 | 27 | |
28 | - protected function assertPostConditions() |
|
29 | - { |
|
30 | - $this->assertPostConditions = true; |
|
31 | - } |
|
28 | + protected function assertPostConditions() |
|
29 | + { |
|
30 | + $this->assertPostConditions = true; |
|
31 | + } |
|
32 | 32 | |
33 | - protected function tearDown() |
|
34 | - { |
|
35 | - $this->tearDown = true; |
|
36 | - } |
|
33 | + protected function tearDown() |
|
34 | + { |
|
35 | + $this->tearDown = true; |
|
36 | + } |
|
37 | 37 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | class NonStatic |
3 | 3 | { |
4 | - public function suite() |
|
5 | - { |
|
6 | - } |
|
4 | + public function suite() |
|
5 | + { |
|
6 | + } |
|
7 | 7 | } |
@@ -3,12 +3,12 @@ |
||
3 | 3 | |
4 | 4 | class CoverageNotProtectedTest extends TestCase |
5 | 5 | { |
6 | - /** |
|
7 | - * @covers CoveredClass::<!protected> |
|
8 | - */ |
|
9 | - public function testSomething() |
|
10 | - { |
|
11 | - $o = new CoveredClass; |
|
12 | - $o->publicMethod(); |
|
13 | - } |
|
6 | + /** |
|
7 | + * @covers CoveredClass::<!protected> |
|
8 | + */ |
|
9 | + public function testSomething() |
|
10 | + { |
|
11 | + $o = new CoveredClass; |
|
12 | + $o->publicMethod(); |
|
13 | + } |
|
14 | 14 | } |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | class Mockable |
3 | 3 | { |
4 | - public $constructorCalled = false; |
|
5 | - public $cloned = false; |
|
4 | + public $constructorCalled = false; |
|
5 | + public $cloned = false; |
|
6 | 6 | |
7 | - public function __construct() |
|
8 | - { |
|
9 | - $this->constructorCalled = false; |
|
10 | - } |
|
7 | + public function __construct() |
|
8 | + { |
|
9 | + $this->constructorCalled = false; |
|
10 | + } |
|
11 | 11 | |
12 | - public function foo() |
|
13 | - { |
|
14 | - return true; |
|
15 | - } |
|
12 | + public function foo() |
|
13 | + { |
|
14 | + return true; |
|
15 | + } |
|
16 | 16 | |
17 | - public function bar() |
|
18 | - { |
|
19 | - return true; |
|
20 | - } |
|
17 | + public function bar() |
|
18 | + { |
|
19 | + return true; |
|
20 | + } |
|
21 | 21 | |
22 | - public function __clone() |
|
23 | - { |
|
24 | - $this->cloned = true; |
|
25 | - } |
|
22 | + public function __clone() |
|
23 | + { |
|
24 | + $this->cloned = true; |
|
25 | + } |
|
26 | 26 | } |
@@ -14,73 +14,73 @@ |
||
14 | 14 | */ |
15 | 15 | class BankAccountTest extends TestCase |
16 | 16 | { |
17 | - protected $ba; |
|
17 | + protected $ba; |
|
18 | 18 | |
19 | - protected function setUp() |
|
20 | - { |
|
21 | - $this->ba = new BankAccount; |
|
22 | - } |
|
19 | + protected function setUp() |
|
20 | + { |
|
21 | + $this->ba = new BankAccount; |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * @covers BankAccount::getBalance |
|
26 | - * @group balanceIsInitiallyZero |
|
27 | - * @group specification |
|
28 | - */ |
|
29 | - public function testBalanceIsInitiallyZero() |
|
30 | - { |
|
31 | - /* @Given a fresh bank account */ |
|
32 | - $ba = new BankAccount; |
|
24 | + /** |
|
25 | + * @covers BankAccount::getBalance |
|
26 | + * @group balanceIsInitiallyZero |
|
27 | + * @group specification |
|
28 | + */ |
|
29 | + public function testBalanceIsInitiallyZero() |
|
30 | + { |
|
31 | + /* @Given a fresh bank account */ |
|
32 | + $ba = new BankAccount; |
|
33 | 33 | |
34 | - /* @When I ask it for its balance */ |
|
35 | - $balance = $ba->getBalance(); |
|
34 | + /* @When I ask it for its balance */ |
|
35 | + $balance = $ba->getBalance(); |
|
36 | 36 | |
37 | - /* @Then I should get 0 */ |
|
38 | - $this->assertEquals(0, $balance); |
|
39 | - } |
|
37 | + /* @Then I should get 0 */ |
|
38 | + $this->assertEquals(0, $balance); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @covers BankAccount::withdrawMoney |
|
43 | - * @group balanceCannotBecomeNegative |
|
44 | - * @group specification |
|
45 | - */ |
|
46 | - public function testBalanceCannotBecomeNegative() |
|
47 | - { |
|
48 | - try { |
|
49 | - $this->ba->withdrawMoney(1); |
|
50 | - } catch (BankAccountException $e) { |
|
51 | - $this->assertEquals(0, $this->ba->getBalance()); |
|
41 | + /** |
|
42 | + * @covers BankAccount::withdrawMoney |
|
43 | + * @group balanceCannotBecomeNegative |
|
44 | + * @group specification |
|
45 | + */ |
|
46 | + public function testBalanceCannotBecomeNegative() |
|
47 | + { |
|
48 | + try { |
|
49 | + $this->ba->withdrawMoney(1); |
|
50 | + } catch (BankAccountException $e) { |
|
51 | + $this->assertEquals(0, $this->ba->getBalance()); |
|
52 | 52 | |
53 | - return; |
|
54 | - } |
|
53 | + return; |
|
54 | + } |
|
55 | 55 | |
56 | - $this->fail(); |
|
57 | - } |
|
56 | + $this->fail(); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @covers BankAccount::depositMoney |
|
61 | - * @group balanceCannotBecomeNegative |
|
62 | - * @group specification |
|
63 | - */ |
|
64 | - public function testBalanceCannotBecomeNegative2() |
|
65 | - { |
|
66 | - try { |
|
67 | - $this->ba->depositMoney(-1); |
|
68 | - } catch (BankAccountException $e) { |
|
69 | - $this->assertEquals(0, $this->ba->getBalance()); |
|
59 | + /** |
|
60 | + * @covers BankAccount::depositMoney |
|
61 | + * @group balanceCannotBecomeNegative |
|
62 | + * @group specification |
|
63 | + */ |
|
64 | + public function testBalanceCannotBecomeNegative2() |
|
65 | + { |
|
66 | + try { |
|
67 | + $this->ba->depositMoney(-1); |
|
68 | + } catch (BankAccountException $e) { |
|
69 | + $this->assertEquals(0, $this->ba->getBalance()); |
|
70 | 70 | |
71 | - return; |
|
72 | - } |
|
71 | + return; |
|
72 | + } |
|
73 | 73 | |
74 | - $this->fail(); |
|
75 | - } |
|
74 | + $this->fail(); |
|
75 | + } |
|
76 | 76 | |
77 | - /* |
|
77 | + /* |
|
78 | 78 | * @covers BankAccount::getBalance |
79 | 79 | * @covers BankAccount::depositMoney |
80 | 80 | * @covers BankAccount::withdrawMoney |
81 | 81 | * @group balanceCannotBecomeNegative |
82 | 82 | */ |
83 | - /* |
|
83 | + /* |
|
84 | 84 | public function testDepositingAndWithdrawingMoneyWorks() |
85 | 85 | { |
86 | 86 | $this->assertEquals(0, $this->ba->getBalance()); |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class InheritanceB extends TestCase |
6 | 6 | { |
7 | - public function testSomething() |
|
8 | - { |
|
9 | - } |
|
7 | + public function testSomething() |
|
8 | + { |
|
9 | + } |
|
10 | 10 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/InheritanceB.php'; |
|
3 | +require_once __DIR__.'/InheritanceB.php'; |
|
4 | 4 | |
5 | 5 | class InheritanceA extends InheritanceB |
6 | 6 | { |