Code Duplication    Length = 9-10 lines in 8 locations

tests/TestCase/Controller/Component/CurrencyConverterComponentTest.php 4 locations

@@ 83-92 (lines=10) @@
80
        $this->assertEquals($expected, $this->CurrencyConverter->getConfig());
81
    }
82
83
    public function testConvertSameCurrency()
84
    {
85
        $amount = 20.00;
86
        $fromCurrency = 'EUR';
87
        $toCurrency = 'EUR';
88
89
        $result = $this->CurrencyConverter->convert($amount, $fromCurrency, $toCurrency);
90
        $expected = 20.00;
91
        $this->assertEquals($expected, $result);
92
    }
93
94
    public function testConvertWithComma()
95
    {
@@ 94-103 (lines=10) @@
91
        $this->assertEquals($expected, $result);
92
    }
93
94
    public function testConvertWithComma()
95
    {
96
        $amount = '20.00';
97
        $fromCurrency = 'EUR';
98
        $toCurrency = 'EUR';
99
100
        $result = $this->CurrencyConverter->convert($amount, $fromCurrency, $toCurrency);
101
        $expected = 20.00;
102
        $this->assertEquals($expected, $result);
103
    }
104
105
    public function testConvertNumberFormatting()
106
    {
@@ 185-193 (lines=9) @@
182
        $this->assertEquals(1, $result);
183
    }
184
185
    public function testRateSameCurrency()
186
    {
187
        $fromCurrency = 'EUR';
188
        $toCurrency = 'EUR';
189
190
        $result = $this->CurrencyConverter->rate($fromCurrency, $toCurrency);
191
        $expected = 1;
192
        $this->assertEquals($expected, $result);
193
    }
194
195
    public function testRateUsingDatabaseWhenRateDoNotExistInDatabase()
196
    {
@@ 206-215 (lines=10) @@
203
        $this->assertEquals($expected, $result);
204
    }
205
206
    public function testRateUsingDatabaseWhenRateExistInDatabaseAndNoNeedToBeUpdated()
207
    {
208
        $fromCurrency = 'EUR';
209
        $toCurrency = 'GBP';
210
211
        $result = $this->CurrencyConverter->rate($fromCurrency, $toCurrency);
212
        $expected = 0.8;
213
214
        $this->assertEquals($expected, $result);
215
    }
216
217
    public function testRateUsingDatabaseWhenRateExistInDatabaseAndNeedToBeUpdated()
218
    {

tests/TestCase/View/Helper/CurrencyConverterHelperTest.php 4 locations

@@ 83-92 (lines=10) @@
80
        $this->assertEquals($expected, $this->Component->getConfig());
81
    }
82
83
    public function testConvertSameCurrency()
84
    {
85
        $amount = 20.00;
86
        $fromCurrency = 'EUR';
87
        $toCurrency = 'EUR';
88
89
        $result = $this->CurrencyConverter->convert($amount, $fromCurrency, $toCurrency);
90
        $expected = 20.00;
91
        $this->assertEquals($expected, $result);
92
    }
93
94
    public function testConvertWithComma()
95
    {
@@ 94-103 (lines=10) @@
91
        $this->assertEquals($expected, $result);
92
    }
93
94
    public function testConvertWithComma()
95
    {
96
        $amount = '20.00';
97
        $fromCurrency = 'EUR';
98
        $toCurrency = 'EUR';
99
100
        $result = $this->CurrencyConverter->convert($amount, $fromCurrency, $toCurrency);
101
        $expected = 20.00;
102
        $this->assertEquals($expected, $result);
103
    }
104
105
    public function testConvertNumberFormatting()
106
    {
@@ 186-194 (lines=9) @@
183
        $this->assertEquals(1, $result);
184
    }
185
186
    public function testRateSameCurrency()
187
    {
188
        $fromCurrency = 'EUR';
189
        $toCurrency = 'EUR';
190
191
        $result = $this->CurrencyConverter->rate($fromCurrency, $toCurrency);
192
        $expected = 1;
193
        $this->assertEquals($expected, $result);
194
    }
195
196
    public function testRateUsingDatabaseWhenRateDoNotExistInDatabase()
197
    {
@@ 207-216 (lines=10) @@
204
        $this->assertEquals($expected, $result);
205
    }
206
207
    public function testRateUsingDatabaseWhenRateExistInDatabaseAndNoNeedToBeUpdated()
208
    {
209
        $fromCurrency = 'EUR';
210
        $toCurrency = 'GBP';
211
212
        $result = $this->CurrencyConverter->rate($fromCurrency, $toCurrency);
213
        $expected = 0.8;
214
215
        $this->assertEquals($expected, $result);
216
    }
217
218
    public function testRateUsingDatabaseWhenRateExistInDatabaseAndNeedToBeUpdated()
219
    {