Skip to content

Commit 1b13d8d

Browse files
committed
Improve chapter 08.
1 parent 26b1dac commit 1b13d8d

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

08 - Testing/01 - Writing Tests.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
// 1. Create a new PHPUnit test file. From the navigation bar, create a new file using the PHPUnit template.
1414
// Note that another way of creating a test is to use the Go to Test navigation:
15-
// - Navigate to the Queue class
16-
// - Use the Go to Test navigation to either go to test or create a new test
15+
// - Navigate to the Queue class.
16+
// - Use the Go to Test navigation to either go to test or create a new test.
1717
//
1818
// 2. For Fully Qualified name, search for the Queue class.
1919
// All other parameters for the unit test class can be kept at their defaults.
@@ -25,11 +25,10 @@
2525
//
2626
// }
2727
//
28-
// 3. Add a function called setUp() which sets up a new Queue in a new field called $_queue;
28+
// 3. Add a function called setUp() which sets up a new Queue in a new field called $_queue;.
2929
// To generate the setUp() function, we can use the Generate | Override method action (Alt+Insert / Command+N).
3030
//
3131
// This is what the class should look like:
32-
// (note: the Code | Comment With Line Comment menu may be handy if you are copy/pasting the below code)
3332
//
3433
// class QueueTest extends \PHPUnit_Framework_TestCase {
3534
// /** @var Queue */
@@ -40,7 +39,9 @@
4039
// }
4140
// }
4241
//
43-
// 4. Add a first test, verifying the enqueue() method. This can be done using Alt+Insert / Command+N
42+
// Note: the Code | Comment With Line Comment menu may be handy if you are copy/pasting the above code.
43+
//
44+
// 4. Add a first test, verifying the enqueue() method. This can be done using Alt+Insert / Command+N.
4445
//
4546
// public function testEnqueueIncreasesItemCount() {
4647
// $this->_queue->enqueue('test');

08 - Testing/03 - Test Driven Development.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
//
2626
// In other words: if items are in queue, peek() should return true. It should return false if no items are in queue.
2727
//
28-
// 2. PhpStorm displays an inspection on the peek() method: Method peek() not found in class Queue
28+
// 2. PhpStorm displays an inspection on the peek() method: Method peek() not found in class Queue.
2929
// Using Alt+Enter, create the method.
3030
// Implement the method.
3131
// 3. Run unit tests and see tests are all passing.

08 - Testing/04 - Code Coverage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
namespace Testing\JetBrains;
99

1010
// 1. Run the unit tests created earlier with Code Coverage enabled.
11-
// This can be done using the "Run tests with Coverage" action (try Search Everywhere or the toolbar)
11+
// This can be done using the "Run tests with Coverage" action (try Search Everywhere or the toolbar).
1212
// 2. Explore code coverage results from the Code Coverage tool window.
1313
// Using F4 or double-clicking, navigate to Queue.php and see which lines of code are tested and which ones are not.

08 - Testing/05 - JavaScript testing.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
* JavaScript Unit Testing (using Karma)
33
*/
44

5-
// 1. Install the Karma plugin (IDE Settings | Plugins)
5+
// 1. Install the Karma plugin (IDE Settings | Plugins).
66
// 2. Install the Karma test runner on your system using NPM:
77
// npm install -g karma
88
// (or use Project Settings | Node.js and NPM, search Karma and add the -g install option)
99
// 3. Make sure a Karma configuration is created. Either rename karma.conf.js.sample to karma.conf.js or set it up manually.
1010
//
11-
// Manual steps: Open a terminal (Tools | Open Terminal) and initialize karma in the current folder
11+
// Manual steps: Open a terminal (Tools | Open Terminal) and initialize karma in the current folder.
1212
// cd "08 - Testing"
1313
// karma init
1414
//
15-
// - Select the test framework to use, we'll go with jasmine
16-
// - Select "no" on using Require.js
17-
// - Select the browser to capture
15+
// - Select the test framework to use, we'll go with jasmine.
16+
// - Select "no" on using Require.js.
17+
// - Select the browser to capture.
1818
// - For test location, enter *.js so Karma will run all tests in the current folder.
1919
// - For excluding files, leave an empty string. More info can be found in the Karma documentation.
2020
// - For automatically running, select "no". When enabled, this will automatically run unit tests whenever

0 commit comments

Comments
 (0)