added annotation based exporter (#1831)

* added user exporter
* added project exporter
* added customer exporter
* added activity exporter
This commit is contained in:
Kevin Papst
2020-07-21 03:37:51 +02:00
committed by GitHub
parent 93a23f3fa3
commit aee063bb3c
79 changed files with 2980 additions and 215 deletions

View File

@@ -13,6 +13,9 @@ use App\Entity\Customer;
use App\Entity\Project;
use App\Entity\ProjectMeta;
use App\Entity\Team;
use App\Export\Spreadsheet\ColumnDefinition;
use App\Export\Spreadsheet\Extractor\AnnotationExtractor;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Collections\Collection;
use PHPUnit\Framework\TestCase;
@@ -133,4 +136,40 @@ class ProjectTest extends TestCase
self::assertCount(0, $sut->getTeams());
self::assertCount(0, $team->getProjects());
}
public function testExportAnnotations()
{
$sut = new AnnotationExtractor(new AnnotationReader());
$columns = $sut->extract(Project::class);
self::assertIsArray($columns);
$expected = [
['label.id', 'integer'],
['label.name', 'string'],
['label.customer', 'string'],
['label.orderNumber', 'string'],
['label.orderDate', 'datetime'],
['label.project_start', 'datetime'],
['label.project_end', 'datetime'],
['label.color', 'string'],
['label.visible', 'boolean'],
['label.comment', 'string'],
];
self::assertCount(\count($expected), $columns);
foreach ($columns as $column) {
self::assertInstanceOf(ColumnDefinition::class, $column);
}
$i = 0;
foreach ($expected as $item) {
$column = $columns[$i++];
self::assertEquals($item[0], $column->getLabel());
self::assertEquals($item[1], $column->getType());
}
}
}