Skip to content

Commit

Permalink
Merge pull request #290 from NiR-/fix/sf3-tests
Browse files Browse the repository at this point in the history
Add quote to yaml reserved chars in fixtures.
  • Loading branch information
Seldaek committed Nov 26, 2015
2 parents 045d59b + 6e52541 commit d0bdaee
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1
owner: '@user1'
members: <numberBetween(1, 10)>x @user*
created: <dateTimeBetween('-200 days', 'now')>
updated: <dateTimeBetween($created, 'now')>
Expand Down
2 changes: 1 addition & 1 deletion doc/customizing-data-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Nelmio\Data\Geopoint (local):
Nelmio\Entity\Location:
loc{1..100}:
name: <city()>
geopoint: @geo1
geopoint: '@geo1'
```


Expand Down
2 changes: 1 addition & 1 deletion doc/fixtures-refactoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1
owner: '@user1'
members: <numberBetween(1, 10)>x @user*
created: <dateTimeBetween('-200 days', 'now')>
updated: <dateTimeBetween($created, 'now')>
Expand Down
18 changes: 9 additions & 9 deletions doc/relations-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1
owner: '@user1'
```
Alice also allows you to directly reference objects' properties using the ```@name->property``` notation.
Expand All @@ -27,7 +27,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1->username
owner: '@user1->username'
```

To be able to use this feature, your entities have to match some requirements :
Expand All @@ -46,7 +46,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1->id
owner: '@user1->id'
```

If you want to create ten users and ten groups and have each user own one
Expand All @@ -59,7 +59,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group{1..10}:
owner: @user<current()>
owner: '@user<current()>'
```

If you would like a random user instead of a fixed one, you can define a
Expand All @@ -72,7 +72,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user*
owner: '@user*'
```

It will then pick any object whose name matches `user*` where `*` can be any
Expand Down Expand Up @@ -113,8 +113,8 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1
members: [@user2, @user3]
owner: '@user1'
members: ['@user2', '@user3']
```

Another, which is more interesting, is to define a reference with a wildcard,
Expand All @@ -127,7 +127,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group1:
name: Admins
owner: @user1
owner: '@user1'
members: 5x @user*
```

Expand All @@ -149,7 +149,7 @@ Nelmio\Entity\User:
Nelmio\Entity\Group:
group{1..10}:
members: @user{1..10}
members: '@user{1..10}'
```

> **Note**: You do not need to define multi-references inside an array, since
Expand Down
2 changes: 1 addition & 1 deletion tests/Nelmio/Alice/support/fixtures/backslashes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Nelmio\Alice\support\models\User:
user0:
username: |-
\\
friends: [@foo, \@foo, \\@foo, \\\@foo]
friends: ['@foo', \@foo, \\@foo, \\\@foo]
8 changes: 4 additions & 4 deletions tests/Nelmio/Alice/support/fixtures/complete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ Nelmio\Alice\support\models\User:
user{1..10}:
username: <username()>
fullname: <firstName()> <lastName()>
birthDate: 80%? <date> : 0000-00-00
birthDate: '80%? <date> : 0000-00-00'
email: <email()>
favoriteNumber: 40%? <numberBetween(1, 99)>

Nelmio\Alice\support\models\Contact:
contact0:
__construct: [@user0]
__construct: ['@user0']

Nelmio\Alice\support\models\Group:
group{0...1}:
name: <company()>
members: 20%? 3x @user*
owner: @user<current()>
owner: '@user<current()>'
group1:
name: <company()>
members: 3x @user*
owner: 1
contactPerson: @contact*->user
contactPerson: '@contact*->user'
contactPersonName: <contactName($contactPerson)>
4 changes: 2 additions & 2 deletions tests/Nelmio/Alice/support/fixtures/include.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ parameters:
Nelmio\Alice\fixtures\Product:
product0:
changed: y
user: @user1
user: '@user1'
product1:
amount: 45
paid: n
user: @user0
user: '@user0'

Nelmio\Alice\fixtures\Shop:
shop1:
Expand Down
4 changes: 2 additions & 2 deletions tests/Nelmio/Alice/support/fixtures/part_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Nelmio\Alice\support\models\User:
user{1..10}:
username: <username()>
fullname: <firstName()> <lastName()>
birthDate: 80%? <date> : 0000-00-00
birthDate: '80%? <date> : 0000-00-00'
email: <email()>
favoriteNumber: 40%? <numberBetween(1, 99)>

Expand All @@ -17,7 +17,7 @@ Nelmio\Alice\support\models\User:
favoriteNumber: 127
user_full (template, extends user_bare):
fullname: <firstName()> <lastName()>
birthDate: 80%? <date> : 0000-00-00
birthDate: '80%? <date> : 0000-00-00'
email: <email()>
favoriteNumber: 40%? <numberBetween(1, 99)>
user11 (extends user_full):
Expand Down
6 changes: 3 additions & 3 deletions tests/Nelmio/Alice/support/fixtures/part_2.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Nelmio\Alice\support\models\Contact:
contact0:
__construct: [@user0]
__construct: ['@user0']

Nelmio\Alice\support\models\Group:
group{0...1}:
name: <company()>
members: 20%? 3x @user*
owner: @user<current()>
owner: '@user<current()>'
group1:
name: <company()>
members: 3x @user*
owner: 1
contactPerson: @contact*->user
contactPerson: '@contact*->user'
contactPersonName: <contactName($contactPerson)>
6 changes: 3 additions & 3 deletions tests/Nelmio/Alice/support/fixtures/sequenced_items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
uuid: <current()>
username: <username()>
fullname: <firstName()> <lastName()>
birthDate: 80%? <date> : 0000-00-00
birthDate: '80%? <date> : 0000-00-00'
email: <email()>
favoriteNumber: 40%? <numberBetween(1, 99)>

Expand All @@ -12,5 +12,5 @@
Nelmio\Alice\support\models\Group:
group1:
name: <company()>
members: @user{1..10}
owner: @user2
members: '@user{1..10}'
owner: '@user2'

0 comments on commit d0bdaee

Please sign in to comment.