Skip to content

Commit f2909d7

Browse files
authored
unify syntax in readmes (#30)
1 parent 7ca99da commit f2909d7

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

.docs/README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This library is here to help you with Integration and [Functional Tests](http://
66

77
- [Setup](#setup)
88
- [Usage](#usage)
9-
- [DI module - Nette\DI integration](#nettedimodule)
10-
- [Application module - Nette\Application integration](#netteapplicationmodule)
9+
- [DI module - Nette\DI integration](#nettedimodule)
10+
- [Application module - Nette\Application integration](#netteapplicationmodule)
1111
- [Development](#development)
1212

1313
## Setup
@@ -22,7 +22,7 @@ composer require contributte/codeception
2222

2323
When you want to write an integration test to make sure that some services work well together you need to create the DI container first.
2424

25-
```yml
25+
```yaml
2626
# /tests/integration.suite.yml
2727
error_level: "E_ALL"
2828
class_name: IntegrationSuiteTester
@@ -42,35 +42,36 @@ modules:
4242
# newContainerForEachTest: true
4343
```
4444

45-
```yml
45+
```neon
4646
# /tests/integration/config/config.neon
4747
services:
48-
- MyService
48+
- MyService
4949
```
5050

5151
```php
5252
# /tests/integration/src/MyServiceTest.php
5353
use Codeception\Test\Unit;
54+
5455
class MyServiceTest extends Unit
5556
{
56-
public function testMyService(): void
57-
{
58-
// Here you can override the configFiles from integration.suite.yml if needed.
59-
// The newContainerForEachTest option is required for this.
60-
// $this->tester->useConfigFiles(['config/another-config.neon']);
61-
$this->assertInstanceOf(MyService::class, $this->tester->grabService(MyService::class));
62-
}
57+
public function testMyService(): void
58+
{
59+
// Here you can override the configFiles from integration.suite.yml if needed.
60+
// The newContainerForEachTest option is required for this.
61+
// $this->tester->useConfigFiles(['config/another-config.neon']);
62+
$this->assertInstanceOf(MyService::class, $this->tester->grabService(MyService::class));
63+
}
6364
}
6465
```
65-
`useConfigFiles` method takes array of file paths that are either absolute or relative to suite root.
66+
`useConfigFiles` method takes array of file paths that are either absolute or relative to suite root.
6667

6768
### NetteApplicationModule
6869

6970
In functional tests you want to emulate the HTTP request and run `Nette\Application\Application` to handle it.
7071

7172
Unfortunately Nette framework has some downsides like the fact that Request and Response are registered as services in the DI Container. For this reason the NetteApplicationModule requires `Contributte\Codeception\DI\CodeceptionExtension` to override the default implementations. **Beware that this is meant for the functional tests only. Do NOT register the extension outside of tests.**
7273

73-
```yml
74+
```yaml
7475
# /tests/functional.suite.yml
7576
error_level: "E_ALL"
7677
class_name: FunctionalSuiteTester
@@ -86,25 +87,25 @@ modules:
8687
- config/config.neon
8788
```
8889
89-
```yml
90+
```neon
9091
# /tests/functional/config/config.neon
9192
extensions:
92-
codeception: Contributte\Codeception\DI\HttpExtension
93+
codeception: Contributte\Codeception\DI\HttpExtension
9394
```
9495

9596
```php
9697
# /tests/functional/src/HomepageTest.php
9798
use Codeception\Test\Unit;
9899
class HomepageTest extends Unit
99100
{
100-
public function testHomepage(): void
101-
{
102-
// Create http request and run Nette\Application\Application. See Contributte\Codeception\Connector\NetteConnector for details.
103-
$this->tester->amOnPage('/');
104-
// Assert that the response is what you expect.
105-
$this->tester->seeResponseCodeIs(200);
106-
$this->tester->see('Hello World!', 'h1');
107-
}
101+
public function testHomepage(): void
102+
{
103+
// Create http request and run Nette\Application\Application. See Contributte\Codeception\Connector\NetteConnector for details.
104+
$this->tester->amOnPage('/');
105+
// Assert that the response is what you expect.
106+
$this->tester->seeResponseCodeIs(200);
107+
$this->tester->see('Hello World!', 'h1');
108+
}
108109
}
109110
```
110111

@@ -116,7 +117,7 @@ Simply run scripts in `Makefile` and make sure that qa, tester and phpstan passe
116117

117118
You can use these commands to do more specific tasks.
118119

119-
```
120+
```bash
120121
# generate necessary files to run the tests
121122
./vendor/bin/codecept build
122123

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
To install latest version of `contributte/codeception` use [Composer](https://getcomposer.com).
2424

25-
```
25+
```bash
2626
composer require contributte/codeception
2727
```
2828

0 commit comments

Comments
 (0)