@@ -66,7 +66,6 @@ public function testDoctrineCollection()
66
66
$ this ->assertEquals (0 , $ commandTester ->execute (['output ' => $ outputDir , 'config ' => $ config ]));
67
67
68
68
$ person = file_get_contents ($ outputDir .'/AddressBook/Entity/Person.php ' );
69
-
70
69
$ this ->assertContains ('use Doctrine\Common\Collections\ArrayCollection; ' , $ person );
71
70
$ this ->assertContains ('use Doctrine\Common\Collections\Collection; ' , $ person );
72
71
@@ -86,8 +85,8 @@ public function testFluentMutators()
86
85
$ this ->fs ->mkdir ($ outputDir );
87
86
$ commandTester = new CommandTester (new GenerateTypesCommand ());
88
87
$ this ->assertEquals (0 , $ commandTester ->execute (['output ' => $ outputDir , 'config ' => $ config ]));
89
- $ person = file_get_contents ($ outputDir .'/AppBundle/Entity/Person.php ' );
90
88
89
+ $ person = file_get_contents ($ outputDir .'/AppBundle/Entity/Person.php ' );
91
90
$ this ->assertContains (<<<'PHP'
92
91
public function setUrl(?string $url): self
93
92
{
@@ -126,10 +125,30 @@ public function testDoNotGenerateAccessorMethods()
126
125
$ commandTester = new CommandTester (new GenerateTypesCommand ());
127
126
$ this ->assertEquals (0 , $ commandTester ->execute (['output ' => $ outputDir , 'config ' => $ config ]));
128
127
129
- $ organization = file_get_contents ($ outputDir .'/AppBundle/Entity/Person.php ' );
130
- $ this ->assertNotContains ('function get ' , $ organization );
131
- $ this ->assertNotContains ('function set ' , $ organization );
132
- $ this ->assertNotContains ('function add ' , $ organization );
133
- $ this ->assertNotContains ('function remove ' , $ organization );
128
+ $ person = file_get_contents ($ outputDir .'/AppBundle/Entity/Person.php ' );
129
+ $ this ->assertNotContains ('function get ' , $ person );
130
+ $ this ->assertNotContains ('function set ' , $ person );
131
+ $ this ->assertNotContains ('function add ' , $ person );
132
+ $ this ->assertNotContains ('function remove ' , $ person );
133
+ }
134
+
135
+ public function testReadableWritable ()
136
+ {
137
+ $ outputDir = __DIR__ .'/../../build/readable-writable ' ;
138
+ $ config = __DIR__ .'/../config/readable-writable.yaml ' ;
139
+
140
+ $ this ->fs ->mkdir ($ outputDir );
141
+
142
+ $ commandTester = new CommandTester (new GenerateTypesCommand ());
143
+ $ this ->assertEquals (0 , $ commandTester ->execute (['output ' => $ outputDir , 'config ' => $ config ]));
144
+
145
+ $ person = file_get_contents ($ outputDir .'/AppBundle/Entity/Person.php ' );
146
+ $ this ->assertContains ('function getId( ' , $ person );
147
+ $ this ->assertNotContains ('function setId( ' , $ person );
148
+ $ this ->assertContains ('function getName( ' , $ person );
149
+ $ this ->assertNotContains ('function setName( ' , $ person );
150
+ $ this ->assertContains ('function getFriends( ' , $ person );
151
+ $ this ->assertNotContains ('function addFriends( ' , $ person );
152
+ $ this ->assertNotContains ('function removeFriends( ' , $ person );
134
153
}
135
154
}
0 commit comments