diff --git a/src/Keboola/CsvTable/Table.php b/src/Keboola/CsvTable/Table.php index 1457ec1..78b7591 100755 --- a/src/Keboola/CsvTable/Table.php +++ b/src/Keboola/CsvTable/Table.php @@ -30,6 +30,7 @@ class Table extends CsvWriter { public function __construct(string $name, array $header = [], bool $writeHeader = true, Temp $temp = null, $delimiter = CsvOptions::DEFAULT_DELIMITER, $enclosure = CsvOptions::DEFAULT_ENCLOSURE, $lineBreak = "\n") { + $this->name = $name; $this->temp = $temp ? $temp : new Temp('csv-table'); $this->header = $header; $tmpFile = $this->temp ->createTmpFile($name); diff --git a/tests/Keboola/CsvTable/TableTest.php b/tests/Keboola/CsvTable/TableTest.php index 4b000e4..8662e76 100755 --- a/tests/Keboola/CsvTable/TableTest.php +++ b/tests/Keboola/CsvTable/TableTest.php @@ -8,7 +8,7 @@ class TempTest extends TestCase { public function testCreate() { - $table = new Table('filename_suffix', ['first_col', 'second_col']); + $table = new Table('filename', ['first_col', 'second_col']); $this->assertFileExists($table->getPathName()); $this->assertEquals( '"first_col","second_col" @@ -22,6 +22,7 @@ public function testCreate() ), $table->getHeader() ); + $this->assertEquals('filename', $table->getName()); } public function testDontWriteHeader()