-
Notifications
You must be signed in to change notification settings - Fork 17
/
StockTest.php
68 lines (57 loc) · 1.67 KB
/
StockTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
use PHPUnit\Framework\TestCase;
use RadicalLoop\Eod\Config;
use RadicalLoop\Eod\Eod;
use Dotenv\Dotenv;
class StockTest extends TestCase
{
protected $stock;
protected function setUp(): void
{
parent::setUp();
$dotenv = Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->load();
$apiToken = $_ENV['API_TOKEN'];
$this->stock = (new Eod(new Config($apiToken)))->stock();
}
public function test_realtime_api()
{
$content = $this->stock->realTime('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_fundamental_data_api()
{
$content = $this->stock->fundamental('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_dividend_api()
{
$content = $this->stock->dividend('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_splits_api()
{
$content = $this->stock->splits('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_eod_api()
{
$content = $this->stock->eod('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_yahoo_api()
{
$content = $this->stock->yahoo('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_search_api()
{
$content = $this->stock->search('AAPL.US')->json();
$this->assertNotEmpty($content);
}
public function test_search_api_filters_exchange()
{
$content = $this->stock->search('AAPL.US', ['exchange'=>'NASDAQ'])->json();
$this->assertNotEmpty($content);
}
}