Skip to content

Commit 21d48bc

Browse files
committed
Remove dependency from CSV adapter in AnalyzeTest
1 parent be1b369 commit 21d48bc

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/AnalyzeTest.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Flow\ETL\Tests\Integration\DataFrame;
66

7-
use function Flow\ETL\Adapter\CSV\from_csv;
87
use function Flow\ETL\Adapter\Text\from_text;
98
use function Flow\ETL\DSL\datetime_schema;
109
use function Flow\ETL\DSL\df;
1110
use function Flow\ETL\DSL\float_schema;
11+
use function Flow\ETL\DSL\from_array;
1212
use function Flow\ETL\DSL\int_schema;
1313
use function Flow\ETL\DSL\schema;
1414
use function Flow\ETL\DSL\str_schema;
@@ -19,11 +19,17 @@ final class AnalyzeTest extends IntegrationTestCase
1919
public function test_analyzing_csv_file_with_auto_cast() : void
2020
{
2121
$report = df()
22-
->read(from_csv(__DIR__ . '/Fixtures/Analyze/goldstock.csv'))
22+
->read(from_array([
23+
['Index' => 1, 'Date' => '2024-01-19', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
24+
['Index' => 2, 'Date' => '2024-01-20', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
25+
['Index' => 3, 'Date' => '2024-01-21', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
26+
['Index' => 4, 'Date' => '2024-01-22', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
27+
['Index' => 5, 'Date' => '2024-01-23', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
28+
]))
2329
->autoCast()
2430
->run(analyze: true);
2531

26-
$this->assertSame(2511, $report->statistics()->totalRows());
32+
$this->assertSame(5, $report->statistics()->totalRows());
2733
$this->assertEquals(
2834
schema(
2935
int_schema('Index'),
@@ -42,11 +48,17 @@ public function test_analyzing_csv_file_with_auto_cast() : void
4248
public function test_analyzing_csv_file_with_limit() : void
4349
{
4450
$report = df()
45-
->read(from_csv(__DIR__ . '/Fixtures/Analyze/goldstock.csv'))
46-
->limit(100)
51+
->read(from_array([
52+
['Index' => '1', 'Date' => '2024-01-19', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
53+
['Index' => '2', 'Date' => '2024-01-20', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
54+
['Index' => '3', 'Date' => '2024-01-21', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
55+
['Index' => '4', 'Date' => '2024-01-22', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
56+
['Index' => '5', 'Date' => '2024-01-23', 'Close' => '2029.3', 'Volume' => '166078.0', 'Open' => '2027.4', 'High' => '2041.9', 'Low' => '2022.2'],
57+
]))
58+
->limit(2)
4759
->run(analyze: true);
4860

49-
$this->assertSame(100, $report->statistics()->totalRows());
61+
$this->assertSame(2, $report->statistics()->totalRows());
5062
$this->assertEquals(
5163
schema(
5264
str_schema('Index'),

0 commit comments

Comments
 (0)