@@ -45,6 +45,36 @@ public function getDataForTestFetch()
45
45
yield 'Test foreign cash selling type ' => [RateType::FOREIGN_CASH_SELLING , 'GBP ' , 148.3312 ];
46
46
}
47
47
48
+ /**
49
+ * @test
50
+ * @dataProvider getDataForTestFetchEur
51
+ *
52
+ * @return void
53
+ */
54
+ public function testFetchEur (string $ type , float $ expectedValue )
55
+ {
56
+ $ source = new ApiSource ();
57
+
58
+ $ result = $ source ->fetch ('EUR ' , $ type , new \DateTime ('2024-01-01 ' ));
59
+ $ this ->assertSame ($ expectedValue , $ result ->getValue ());
60
+ $ this ->assertSame ('banca_intesa_serbia ' , $ result ->getSourceName ());
61
+ $ this ->assertSame ('EUR ' , $ result ->getCurrencyCode ());
62
+ $ this ->assertSame ($ type , $ result ->getRateType ());
63
+ $ this ->assertSame ('RSD ' , $ result ->getBaseCurrencyCode ());
64
+ }
65
+
66
+ /**
67
+ * @return iterable<string, array{string, float}>
68
+ */
69
+ public function getDataForTestFetchEur ()
70
+ {
71
+ yield 'Test median type ' => [RateType::MEDIAN , 117.1737 ];
72
+ yield 'Test foreign exchange buying type ' => [RateType::FOREIGN_EXCHANGE_BUYING , 114.2444 ];
73
+ yield 'Test foreign cash buying type ' => [RateType::FOREIGN_CASH_BUYING , 114.2444 ];
74
+ yield 'Test foreign exchange selling type ' => [RateType::FOREIGN_EXCHANGE_SELLING , 120.103 ];
75
+ yield 'Test foreign cash selling type ' => [RateType::FOREIGN_CASH_SELLING , 118.6384 ];
76
+ }
77
+
48
78
/**
49
79
* @return void
50
80
*/
0 commit comments