Skip to content

Commit 594e4dc

Browse files
author
Fernando Perales
committed
Make some corrections on README file
1 parent 63597cd commit 594e4dc

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# CrowdPHPSpecTraining
22

3-
At Crowd Interactive we are interested in testing all our code, and Magento is not the exception. We are implementing the [MageTest/MageSpec](http://tinyurl.com/nednm2x) Module based on [PHPSpec](http://tinyurl.com/q6xqvgo) toolset.
3+
At Crowd Interactive, we are interested in testing all our code and Magento is not the exception. We are implementing the [MageTest/MageSpec](http://tinyurl.com/nednm2x) Module based on [PHPSpec](http://tinyurl.com/q6xqvgo) toolset.
44

5-
In this implementation we have 2 different tests taking of the [Magecasts](http://tinyurl.com/qxs5ux8) tutorials. The first is to understand how PHPSpec works.
5+
In this implementation, we have two different tests taken from the [Magecasts](http://tinyurl.com/qxs5ux8) tutorials. The first one is to understand how PHPSpec works.
66

77
## First Test
88

9-
"We will look at PHPspec and how we can use PHPspec to enhance our development workflow".
9+
"We will look at PHPspec and how we can use it to enhance our development workflow".
1010

11-
### Prerequisites
11+
### Prerequisites
1212

1313
PHP 5.3.x or greater
1414
Install composer
@@ -17,7 +17,7 @@ In this implementation we have 2 different tests taking of the [Magecasts](http:
1717

1818
#### Create composer.json file
1919

20-
On root project create composer.json file with the below data
20+
On root project, create composer.json file with the data below:
2121

2222
```json
2323
{
@@ -39,7 +39,7 @@ On root project create composer.json file with the below data
3939

4040
$ composer install
4141

42-
You will get something like this :
42+
You will get something like this:
4343

4444
```bash
4545
Loading composer repositories with package information
@@ -96,11 +96,11 @@ phpspec/phpspec suggests installing phpspec/nyan-formatters (~1.0 – Adds Nyan
9696

9797
#### PHPSpec run command
9898

99-
Now we have bin/ and vendor/ directory in or project, lets go with this
99+
Now that we have bin/ and vendor/ directory in our project, let's go with this:
100100

101101
$ bin/phpsepc run
102102

103-
And you will see this
103+
And you will see:
104104

105105
```bash
106106
0 specs
@@ -112,7 +112,7 @@ And you will see this
112112

113113
$ bin/phpspec describe Crowd/Store/Product
114114

115-
It will return this messages
115+
Will return this message:
116116

117117
```bash
118118
Specification for Crowd\Store\Product created in [magentoroot]/spec/Crowd/Store/ProductSpec.php
@@ -123,7 +123,7 @@ In your folder project now you will see
123123
![spec folder]
124124
(http://i.imgur.com/p9uu1TX.png)
125125
126-
The content of ProductSpec.php file created looks like this
126+
The content of the ProductSpec.php created file looks like this:
127127
128128
```php
129129
<?php
@@ -144,12 +144,12 @@ class ProductSpec extends ObjectBehavior
144144
145145
$ bin/phpspec run
146146
147-
And now you will see this
147+
And now you will see this:
148148
149149
![class does not exists]
150150
(http://i.imgur.com/0iZ7OV5.png)
151151
152-
Obviously you write YES and you will get the next message
152+
Obviously you type YES and you will get the next message:
153153
154154
![class was created]
155155
(http://i.imgur.com/r4oTSWn.png)
@@ -159,7 +159,7 @@ And the next file structure in your project
159159
![src file structure]
160160
(http://i.imgur.com/4DAdc3t.png)
161161
162-
Inside Product.php you will see
162+
Inside Product.php you will see
163163
164164
```php
165165
<?php
@@ -171,7 +171,7 @@ class Product
171171
}
172172
```
173173
174-
Now inside [magentoroot]/spec/Crowd/Store/ProductSpec.php file write the next functions
174+
Now inside [magentoroot]/spec/Crowd/Store/ProductSpec.php file, write the next functions
175175
176176
```php
177177
function it_should_have_a_name()
@@ -181,11 +181,11 @@ function it_should_have_a_name()
181181

182182
function it_should_have_sku()
183183
{
184-
$this->getSku()->shouldReturn('12345');
184+
$this->getSku()->shouldReturn('12345');
185185
}
186186
```
187187
188-
The complete files looks like
188+
The complete files looks like:
189189
190190
```php
191191
<?php
@@ -209,35 +209,35 @@ class ProductSpec extends ObjectBehavior
209209

210210
function it_should_have_sku()
211211
{
212-
$this->getSku()->shouldReturn('12345');
212+
$this->getSku()->shouldReturn('12345');
213213
}
214214
}
215215
```
216216
217-
What are we doing here? Well, we are defining two test functions more, one to check if a function called getName() returns a string with value "Testing Spec" and other to check if a function called getSku() returns a string with value "12345"
217+
What are we doing here? Well, we are defining two more test functions, one to check if a function called getName() returns a string with value "Testing Spec" and other to check if a function called getSku() returns a string with value "12345"
218218
219-
On terminal lets do
219+
On terminal lets do:
220220
221221
$ bin/phpspec run
222222
223-
It will display
223+
It will display:
224224
225225
![getName() function does not exists]
226226
(http://i.imgur.com/aT7yySp.png)
227227
228-
Press Y + return key and you should have this
228+
Press Y + return key:
229229
230230
![getSku() function does not exists]
231231
(http://i.imgur.com/6KUmIbi.png)
232232
233-
Press Y + return key again and should have this
233+
Press Y + return key again:
234234
235235
![functions exists but tests does not pass]
236236
(http://i.imgur.com/eOieqj8.png)
237237
238-
What that means? First of all, PHPSpec checks if getName() and getSku() functions exists in the Product class, and it does not find them and ask us if we want to crete them. Once created PHPSpec tries to run the tests but they do not pass.
238+
What does this mean? First of all, PHPSpec checks if getName() and getSku() functions exists in the Product class, and if it does not find them, asks us if we want to crete them. Once created, PHPSpec will try to run the tests, but they do not pass.
239239
240-
The Product.php file under [magentoroot]/src/Crowd/Store/ change it content amd now looks like
240+
The Product.php file under [magentoroot]/src/Crowd/Store/ changed its content and now looks like:
241241
242242
```php
243243
<?php
@@ -259,7 +259,7 @@ class Product
259259
}
260260
```
261261
262-
That's the why about tests not pass. Becouse the functions exists but, they do nothing. Lets work with them typing the following in Product.php
262+
That's the reason of out tests not passing: the functions exist, but they do nothing. Lets work with them and type the following in Product.php
263263
264264
```php
265265
<?php
@@ -280,7 +280,7 @@ class Product
280280
281281
public function getName()
282282
{
283-
return $this->_name;
283+
return $this->_name;
284284
}
285285
286286
public function getSku()
@@ -290,16 +290,16 @@ class Product
290290
}
291291
```
292292
293-
Type again
293+
Run the specs again:
294294
295-
$ bin/phpspec run
295+
$ bin/phpspec run
296296
297-
And, oh them do not pass again. Why?
297+
And... oh!, they don't pass again. Why?
298298
299299
![test not pass again]
300300
(http://i.imgur.com/4ODyU1i.png)
301301
302-
That happend becouse phpspec its running without any init data. To do that lets type following inside ProductSpec class
302+
This happened because phpspec is running without any init data. To do that, let's type the following inside ProductSpec class:
303303
304304
```php
305305
function let()
@@ -310,13 +310,13 @@ function let()
310310
}
311311
```
312312
313-
The let() method is used to pass data into constructor each time the parser gets constructed using beConstructedWith() method
313+
The let() method is used to pass data into the constructor each time the parser gets created using the beConstructedWith() method
314314
315-
Now on the console type once again
315+
Now on the console, type once again
316316
317317
$ bin/phpspec run
318318
319319
![test pass]
320320
(http://i.imgur.com/YEOFaUC.png)
321321
322-
And we did it guys.
322+
And we did it, friends!.

0 commit comments

Comments
 (0)