Skip to content

Commit a6f6413

Browse files
authored
[minor] Added .editorconfig to sync up styles (zenstruck#186)
1 parent 2517f54 commit a6f6413

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.yml]
12+
indent_size = 2

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class Post
134134
* @ORM\Column(type="text", nullable=true)
135135
*/
136136
private $body;
137-
137+
138138
/**
139139
* @ORM\Column(type="datetime")
140140
*/
@@ -397,7 +397,7 @@ $posts = PostFactory::new(['title' => 'Post A'])
397397
'body' => 'Post Body...',
398398

399399
// CategoryFactory will be used to create a new Category for each Post
400-
'category' => CategoryFactory::new(['name' => 'php']),
400+
'category' => CategoryFactory::new(['name' => 'php']),
401401
])
402402
->withAttributes([
403403
// Proxies are automatically converted to their wrapped object
@@ -481,7 +481,7 @@ PostFactory::new()
481481
// $object is the persisted Post object
482482
// $attributes contains the attributes used to instantiate the object and any extras
483483
})
484-
484+
485485
// multiple events are allowed
486486
->beforeInstantiate(function($attributes) { return $attributes; })
487487
->afterInstantiate(function() {})
@@ -524,7 +524,7 @@ final class PostFactory extends ModelFactory
524524
return new Post(); // custom instantiation for this factory
525525
})
526526
->afterPersist(function () {}) // default event for this factory
527-
;
527+
;
528528
}
529529
}
530530
```
@@ -662,7 +662,7 @@ protected function getDefaults(): array
662662
'post' => PostFactory::new()->published(),
663663

664664
// NOT RECOMMENDED - will potentially result in extra unintended Posts
665-
'post' => PostFactory::createOne(),
665+
'post' => PostFactory::createOne(),
666666
'post' => PostFactory::new()->published()->create(),
667667
];
668668
}
@@ -964,7 +964,7 @@ Foundry allows each individual test to fully follow the [AAA](https://www.thephi
964964
("Arrange", "Act", "Assert") testing pattern. You create your fixtures using "factories" at the beginning of each test.
965965
You only create fixtures that are applicable for the test. Additionally, these fixtures are created with only the
966966
attributes required for the test - attributes that are not applicable are filled with random data. The created fixture
967-
objects are wrapped in a "proxy" that helps with pre and post assertions.
967+
objects are wrapped in a "proxy" that helps with pre and post assertions.
968968

969969
Let's look at an example:
970970

@@ -978,7 +978,7 @@ public function test_can_post_a_comment(): void
978978
'slug' => 'post-a' // This test only requires the slug field - all other fields are random data
979979
])
980980
;
981-
981+
982982
// 1a. "Pre-Assertions"
983983
$this->assertCount(0, $post->getComments());
984984

@@ -1038,7 +1038,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
10381038
class MyTest extends WebTestCase
10391039
{
10401040
use ResetDatabase, Factories;
1041-
1041+
10421042
// ...
10431043
}
10441044
```
@@ -1370,7 +1370,7 @@ these tests to be unnecessarily slow. You can improve the speed by reducing the
13701370
class UserFactory extends ModelFactory
13711371
{
13721372
public const DEFAULT_PASSWORD = '1234'; // the password used to create the pre-encoded version below
1373-
1373+
13741374
protected function getDefaults(): array
13751375
{
13761376
return [
@@ -1412,7 +1412,7 @@ class MyUnitTest extends TestCase
14121412
}
14131413
```
14141414

1415-
**NOTE**: [Factories as Services](#factories-as-services) and [Stories as Services](#stories-as-services) with required
1415+
**NOTE**: [Factories as Services](#factories-as-services) and [Stories as Services](#stories-as-services) with required
14161416
constructor arguments are not usable in non-Kernel tests. The container is not available to resolve their dependencies.
14171417
The easiest work-around is to make the test an instance of `Symfony\Bundle\FrameworkBundle\Test\KernelTestCase` so the
14181418
container is available.

0 commit comments

Comments
 (0)