@@ -64,6 +64,58 @@ public function testDescriptionCanBeCastToString()
6464 $ this ->assertSame ($ expected , (string )$ fixture );
6565 }
6666
67+ /**
68+ * @covers ::getTags
69+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
70+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
71+ */
72+ public function testDescriptionTagsGetter ()
73+ {
74+ $ body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s) ' ;
75+
76+ $ tag1 = new Generic ('JoinColumn ' , new Description ('(name="column_id", referencedColumnName="id") ' ));
77+ $ tag2 = new Generic ('JoinColumn ' , new Description ('(name="column_id_2", referencedColumnName="id") ' ));
78+
79+ $ tags = [
80+ $ tag1 ,
81+ $ tag2 ,
82+ ];
83+
84+ $ fixture = new Description ($ body , $ tags );
85+
86+ $ this ->assertEquals (2 , count ($ fixture ->getTags ()));
87+
88+ $ actualTags = $ fixture ->getTags ();
89+ $ this ->assertSame ($ tags , $ actualTags );
90+ $ this ->assertSame ($ tag1 , $ actualTags [0 ]);
91+ $ this ->assertSame ($ tag2 , $ actualTags [1 ]);
92+ }
93+
94+ /**
95+ * @covers ::__construct
96+ * @covers ::render
97+ * @covers ::__toString
98+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
99+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
100+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
101+ */
102+ public function testDescriptionMultipleTagsCanBeCastToString ()
103+ {
104+ $ body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s) ' ;
105+
106+ $ tag1 = new Generic ('JoinColumn ' , new Description ('(name="column_id", referencedColumnName="id") ' ));
107+ $ tag2 = new Generic ('JoinColumn ' , new Description ('(name="column_id_2", referencedColumnName="id") ' ));
108+
109+ $ tags = [
110+ $ tag1 ,
111+ $ tag2 ,
112+ ];
113+
114+ $ fixture = new Description ($ body , $ tags );
115+ $ expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")}) ' ;
116+ $ this ->assertSame ($ expected , (string )$ fixture );
117+ }
118+
67119 /**
68120 * @covers ::__construct
69121 * @expectedException \InvalidArgumentException
0 commit comments