feat:create custom data types for market data

This commit is contained in:
hackerESQ
2024-10-29 16:34:18 -05:00
parent 4f6e3c3711
commit 4e6dcd6ff4
11 changed files with 437 additions and 94 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Log;
use App\Interfaces\MarketData\YahooMarketData;
use App\Interfaces\MarketData\FallbackInterface;
use App\Interfaces\MarketData\AlphaVantageMarketData;
use App\Interfaces\MarketData\Types\Quote;
class FallbackInterfaceTest extends TestCase
{
@@ -32,7 +33,7 @@ class FallbackInterfaceTest extends TestCase
$alphaMock = Mockery::mock(AlphaVantageMarketData::class);
$alphaMock->shouldReceive('quote')
->andReturn(collect(['Alpha data']));
->andReturn(new Quote(['market_value' => 10]));
$this->app->instance(YahooMarketData::class, $yahooMock);
$this->app->instance(AlphaVantageMarketData::class, $alphaMock);
@@ -41,7 +42,7 @@ class FallbackInterfaceTest extends TestCase
$result = $fallbackInterface->quote('ACME');
$this->assertEquals(collect(['Alpha data']), $result);
$this->assertEquals(new Quote(['market_value' => 10]), $result);
Log::shouldHaveReceived('warning')->with('Failed calling method quote (yahoo): Yahoo failed');
}