These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminListBundle\Tests\Service; |
||
4 | |||
5 | use Box\Spout\Common\Type; |
||
6 | use Kunstmaan\AdminListBundle\AdminList\ExportableInterface; |
||
7 | use Kunstmaan\AdminListBundle\Service\ExportService; |
||
8 | use PHPUnit\Framework\TestCase; |
||
9 | |||
10 | class ExportServiceTest extends TestCase |
||
11 | { |
||
12 | /** |
||
13 | * @var ExportService |
||
14 | */ |
||
15 | protected $object; |
||
16 | |||
17 | /** |
||
18 | * Sets up the fixture, for example, opens a network connection. |
||
19 | * This method is called before a test is executed. |
||
20 | */ |
||
21 | protected function setUp() |
||
22 | { |
||
23 | $this->object = new ExportService(); |
||
24 | } |
||
25 | |||
26 | public function testGetSupportedExtensions() |
||
27 | { |
||
28 | $extensions = ExportService::getSupportedExtensions(); |
||
29 | $this->assertEquals(['Csv' => 'csv', 'Ods' => 'ods', 'Excel' => 'xlsx'], $extensions); |
||
30 | } |
||
31 | |||
32 | View Code Duplication | public function testGetDownloadableResponseReturnsStreamedResponseWithExcel() |
|
0 ignored issues
–
show
|
|||
33 | { |
||
34 | /** @var ExportableInterface $adminList */ |
||
35 | $adminList = $this->createMock('Kunstmaan\AdminListBundle\AdminList\ExportableInterface'); |
||
36 | |||
37 | $response = $this->object->getDownloadableResponse($adminList, Type::XLSX); |
||
38 | |||
39 | $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); |
||
40 | } |
||
41 | |||
42 | View Code Duplication | public function testGetDownloadableResponseReturnsStreamedResponseWithOds() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
43 | { |
||
44 | /** @var ExportableInterface $adminList */ |
||
45 | $adminList = $this->createMock('Kunstmaan\AdminListBundle\AdminList\ExportableInterface'); |
||
46 | |||
47 | $response = $this->object->getDownloadableResponse($adminList, Type::ODS); |
||
48 | |||
49 | $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); |
||
50 | } |
||
51 | |||
52 | View Code Duplication | public function testGetDownloadableResponseReturnsStreamedResponseWithCsv() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
53 | { |
||
54 | /** @var ExportableInterface $adminList */ |
||
55 | $adminList = $this->createMock('Kunstmaan\AdminListBundle\AdminList\ExportableInterface'); |
||
56 | |||
57 | $response = $this->object->getDownloadableResponse($adminList, Type::CSV); |
||
58 | |||
59 | $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); |
||
60 | } |
||
61 | } |
||
62 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.