@@ -31,7 +31,7 @@ public function testFindPosts()
3131 public function testFindPost ()
3232 {
3333 $ post = Post::findOne (2 );
34- $ this ->assertEquals ('tag2, tag3, tag4 ' , $ post ->tagNames );
34+ $ this ->assertEquals ('tag2, tag3, tag4 ' , $ post ->tagValues );
3535 }
3636
3737 public function testCreatePost ()
@@ -48,63 +48,63 @@ public function testCreatePost()
4848 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
4949 }
5050
51- public function testCreatePostSetTagNames ()
51+ public function testCreatePostSetTagValues ()
5252 {
5353 $ post = new Post ([
5454 'title ' => 'New post title ' ,
5555 'body ' => 'New post body ' ,
56- 'tagNames ' => 'tag4, tag4, tag5, , tag6 ' ,
56+ 'tagValues ' => 'tag4, tag4, tag5, , tag6 ' ,
5757 ]);
5858
5959 $ this ->assertTrue ($ post ->save ());
6060
6161 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
62- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-set-tag-names .xml ' );
62+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-set-tag-values .xml ' );
6363 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
6464 }
6565
66- public function testCreatePostSetTagNamesAsArray ()
66+ public function testCreatePostSetTagValuesAsArray ()
6767 {
6868 $ post = new Post ([
6969 'title ' => 'New post title ' ,
7070 'body ' => 'New post body ' ,
71- 'tagNames ' => ['tag4 ' , 'tag4 ' , 'tag5 ' , '' , 'tag6 ' ],
71+ 'tagValues ' => ['tag4 ' , 'tag4 ' , 'tag5 ' , '' , 'tag6 ' ],
7272 ]);
7373
7474 $ this ->assertTrue ($ post ->save ());
7575
7676 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
77- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-set-tag-names .xml ' );
77+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-set-tag-values .xml ' );
7878 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
7979 }
8080
81- public function testCreatePostAddTagNames ()
81+ public function testCreatePostAddTagValues ()
8282 {
8383 $ post = new Post ([
8484 'title ' => 'New post title ' ,
8585 'body ' => 'New post body ' ,
8686 ]);
8787
88- $ post ->addTagNames ('tag4, tag4, tag5, , tag6 ' );
88+ $ post ->addTagValues ('tag4, tag4, tag5, , tag6 ' );
8989 $ this ->assertTrue ($ post ->save ());
9090
9191 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
92- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-add-tag-names .xml ' );
92+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-add-tag-values .xml ' );
9393 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
9494 }
9595
96- public function testCreatePostAddTagNamesAsArray ()
96+ public function testCreatePostAddTagValuesAsArray ()
9797 {
9898 $ post = new Post ([
9999 'title ' => 'New post title ' ,
100100 'body ' => 'New post body ' ,
101101 ]);
102102
103- $ post ->addTagNames (['tag4 ' , 'tag4 ' , 'tag5 ' , '' , 'tag6 ' ]);
103+ $ post ->addTagValues (['tag4 ' , 'tag4 ' , 'tag5 ' , '' , 'tag6 ' ]);
104104 $ this ->assertTrue ($ post ->save ());
105105
106106 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
107- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-add-tag-names .xml ' );
107+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-create-post-add-tag-values .xml ' );
108108 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
109109 }
110110
@@ -120,91 +120,104 @@ public function testUpdatePost()
120120 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
121121 }
122122
123- public function testUpdatePostSetTagNames ()
123+ public function testUpdatePostSetTagValues ()
124124 {
125125 $ post = Post::findOne (2 );
126126 $ post ->title = 'Updated post title 2 ' ;
127127 $ post ->body = 'Updated post body 2 ' ;
128- $ post ->tagNames = 'tag3, tag3, tag4, , tag6 ' ;
128+ $ post ->tagValues = 'tag3, tag3, tag4, , tag6 ' ;
129129 $ this ->assertTrue ($ post ->save ());
130130
131131 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
132- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-set-tag-names .xml ' );
132+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-set-tag-values .xml ' );
133133 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
134134 }
135135
136- public function testUpdatePostSetTagNamesAsArray ()
136+ public function testUpdatePostSetTagValuesAsArray ()
137137 {
138138 $ post = Post::findOne (2 );
139139 $ post ->title = 'Updated post title 2 ' ;
140140 $ post ->body = 'Updated post body 2 ' ;
141- $ post ->tagNames = ['tag3 ' , 'tag3 ' , 'tag4 ' , '' , 'tag6 ' ];
141+ $ post ->tagValues = ['tag3 ' , 'tag3 ' , 'tag4 ' , '' , 'tag6 ' ];
142142 $ this ->assertTrue ($ post ->save ());
143143
144144 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
145- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-set-tag-names .xml ' );
145+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-set-tag-values .xml ' );
146146 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
147147 }
148148
149- public function testUpdatePostAddTagNames ()
149+ public function testUpdatePostAddTagValues ()
150150 {
151151 $ post = Post::findOne (2 );
152152 $ post ->title = 'Updated post title 2 ' ;
153153 $ post ->body = 'Updated post body 2 ' ;
154- $ post ->addTagNames ('tag3, tag3, , tag6 ' );
154+ $ post ->addTagValues ('tag3, tag3, , tag6 ' );
155155 $ this ->assertTrue ($ post ->save ());
156156
157157 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
158- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-add-tag-names .xml ' );
158+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-add-tag-values .xml ' );
159159 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
160160 }
161161
162- public function testUpdatePostAddTagNamesAsArray ()
162+ public function testUpdatePostAddTagValuesAsArray ()
163163 {
164164 $ post = Post::findOne (2 );
165165 $ post ->title = 'Updated post title 2 ' ;
166166 $ post ->body = 'Updated post body 2 ' ;
167- $ post ->addTagNames (['tag3 ' , 'tag3 ' , '' , 'tag6 ' ]);
167+ $ post ->addTagValues (['tag3 ' , 'tag3 ' , '' , 'tag6 ' ]);
168168 $ this ->assertTrue ($ post ->save ());
169169
170170 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
171- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-add-tag-names .xml ' );
171+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-add-tag-values .xml ' );
172172 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
173173 }
174174
175- public function testUpdatePostRemoveTagNames ()
175+ public function testUpdatePostRemoveTagValues ()
176176 {
177177 $ post = Post::findOne (2 );
178178 $ post ->title = 'Updated post title 2 ' ;
179179 $ post ->body = 'Updated post body 2 ' ;
180- $ post ->removeTagNames ('tag2, tag2, , tag4 ' );
180+ $ post ->removeTagValues ('tag2, tag2, , tag4 ' );
181181 $ this ->assertTrue ($ post ->save ());
182182
183183 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
184- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-remove-tag-names .xml ' );
184+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-remove-tag-values .xml ' );
185185 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
186186 }
187187
188- public function testUpdatePostRemoveTagNamesAsArray ()
188+ public function testUpdatePostRemoveTagValuesAsArray ()
189189 {
190190 $ post = Post::findOne (2 );
191191 $ post ->title = 'Updated post title 2 ' ;
192192 $ post ->body = 'Updated post body 2 ' ;
193- $ post ->removeTagNames (['tag2 ' , 'tag2 ' , '' , 'tag4 ' ]);
193+ $ post ->removeTagValues (['tag2 ' , 'tag2 ' , '' , 'tag4 ' ]);
194194 $ this ->assertTrue ($ post ->save ());
195195
196196 $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
197- $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-remove-tag-names .xml ' );
197+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-remove-tag-values .xml ' );
198198 $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
199199 }
200200
201- public function testPostHasTagNames ()
201+ public function testUpdatePostRemoveAllTagValues ()
202202 {
203203 $ post = Post::findOne (2 );
204- $ this ->assertTrue ($ post ->hasTagNames ('tag2, tag2, , tag4 ' ));
205- $ this ->assertTrue ($ post ->hasTagNames (['tag2 ' , 'tag2 ' , '' , 'tag4 ' ]));
206- $ this ->assertFalse ($ post ->hasTagNames ('tag3, tag3, , tag5 ' ));
207- $ this ->assertFalse ($ post ->hasTagNames (['tag3 ' , 'tag3 ' , '' , 'tag5 ' ]));
204+ $ post ->title = 'Updated post title 2 ' ;
205+ $ post ->body = 'Updated post body 2 ' ;
206+ $ post ->removeAllTagValues ();
207+ $ this ->assertTrue ($ post ->save ());
208+
209+ $ dataSet = $ this ->getConnection ()->createDataSet (['post ' , 'tag ' , 'post_tag_assn ' ]);
210+ $ expectedDataSet = $ this ->createFlatXMLDataSet (__DIR__ . '/data/test-update-post-remove-all-tag-values.xml ' );
211+ $ this ->assertDataSetsEqual ($ expectedDataSet , $ dataSet );
212+ }
213+
214+ public function testPostHasTagValues ()
215+ {
216+ $ post = Post::findOne (2 );
217+ $ this ->assertTrue ($ post ->hasTagValues ('tag2, tag2, , tag4 ' ));
218+ $ this ->assertTrue ($ post ->hasTagValues (['tag2 ' , 'tag2 ' , '' , 'tag4 ' ]));
219+ $ this ->assertFalse ($ post ->hasTagValues ('tag3, tag3, , tag5 ' ));
220+ $ this ->assertFalse ($ post ->hasTagValues (['tag3 ' , 'tag3 ' , '' , 'tag5 ' ]));
208221 }
209222
210223 public function testDeletePost ()
0 commit comments