@@ -13,28 +13,43 @@ public function testGettersAndSetters(): void
1313 $ workId = 'ad904728-2f96-4cbb-973f-70b4414cf27e ' ;
1414 $ publicationType = Publication::PUBLICATION_TYPE_PAPERBACK ;
1515 $ isbn = '987-6-54321-234-5 ' ;
16- $ width = 156.0 ;
17- $ height = 234.0 ;
18- $ depth = 25.0 ;
19- $ weight = 206.0 ;
16+ $ widthMm = 156.0 ;
17+ $ heightMm = 234.0 ;
18+ $ depthMm = 25.0 ;
19+ $ weightG = 206.0 ;
2020
2121 $ publication = new Publication ();
2222 $ publication ->setPublicationId ($ publicationId );
2323 $ publication ->setWorkId ($ workId );
2424 $ publication ->setPublicationType ($ publicationType );
2525 $ publication ->setIsbn ($ isbn );
26- $ publication ->setWidth ( $ width );
27- $ publication ->setHeight ( $ height );
28- $ publication ->setDepth ( $ depth );
29- $ publication ->setWeight ( $ weight );
26+ $ publication ->setWidthMm ( $ widthMm );
27+ $ publication ->setHeightMm ( $ heightMm );
28+ $ publication ->setDepthMm ( $ depthMm );
29+ $ publication ->setWeightG ( $ weightG );
3030
3131 $ this ->assertSame ($ publicationId , $ publication ->getPublicationId ());
3232 $ this ->assertSame ($ workId , $ publication ->getWorkId ());
3333 $ this ->assertSame ($ publicationType , $ publication ->getPublicationType ());
3434 $ this ->assertSame ($ isbn , $ publication ->getIsbn ());
35- $ this ->assertSame ($ width , $ publication ->getWidth ());
36- $ this ->assertSame ($ height , $ publication ->getHeight ());
37- $ this ->assertSame ($ depth , $ publication ->getDepth ());
38- $ this ->assertSame ($ weight , $ publication ->getWeight ());
35+ $ this ->assertSame ($ widthMm , $ publication ->getWidthMm ());
36+ $ this ->assertSame ($ heightMm , $ publication ->getHeightMm ());
37+ $ this ->assertSame ($ depthMm , $ publication ->getDepthMm ());
38+ $ this ->assertSame ($ weightG , $ publication ->getWeightG ());
39+ }
40+
41+ public function testGettersAndSettersWithConvention (): void
42+ {
43+ $ publication = new Publication ();
44+ $ publication ->setWidthMm (156 , true );
45+ $ publication ->setHeightMm (234 , true );
46+ $ publication ->setDepthMm (5 , true );
47+ $ publication ->setWeightG (206 , true );
48+
49+ $ this ->assertSame (6.14 , $ publication ->getWidthIn ());
50+ $ this ->assertSame (9.21 , $ publication ->getHeightIn ());
51+ $ this ->assertSame (0.2 , $ publication ->getDepthIn ());
52+ $ this ->assertSame (7.2664 , $ publication ->getWeightOz ());
53+
3954 }
4055}
0 commit comments