diff --git a/.travis.yml b/.travis.yml index dc863ce..47def81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,14 @@ php: - 7.4 env: - - SYMFONY_VERSION="2.1" - - SYMFONY_VERSION="3.0" + - SYMFONY_VERSION="3.4" + - SYMFONY_VERSION="4.0" + - SYMFONY_VERSION="4.4" before_script: - composer self-update - composer --version - composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update - - composer install -n --dev --prefer-source + - composer install -n --prefer-source script: phpunit --configuration phpunit.xml.dist diff --git a/composer.json b/composer.json index 396ff9b..72e84c0 100644 --- a/composer.json +++ b/composer.json @@ -2,8 +2,9 @@ "name": "xola/reportwriter-bundle", "description": "A generic report writer", "require": { + "ext-json": "*", "php": ">=7.1", - "symfony/framework-bundle": ">=2.1 <4.0", + "symfony/framework-bundle": ">=2.1", "psr/log": "~1.0", "phpoffice/phpspreadsheet": "^1.3" }, diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index 246e7af..7a111e0 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -11,7 +11,7 @@ services: - { name: monolog.logger, channel: csvwriter } excelwriter: - class: %excelwriter.service.class% + class: "%excelwriter.service.class%" arguments: [ "@logger", "@phpexcel" ] tags: - { name: monolog.logger, channel: excelwriter } diff --git a/src/Service/ExcelWriter.php b/src/Service/ExcelWriter.php index 22c3302..29ba511 100644 --- a/src/Service/ExcelWriter.php +++ b/src/Service/ExcelWriter.php @@ -376,4 +376,9 @@ private function incrementColumn($str, $count = 1) return $str; } + + public function getCurrentRow(): int + { + return $this->currentRow; + } } diff --git a/test/Service/ExcelWriterTest.php b/test/Service/ExcelWriterTest.php index fe100ec..f395b41 100644 --- a/test/Service/ExcelWriterTest.php +++ b/test/Service/ExcelWriterTest.php @@ -60,9 +60,7 @@ public function testShouldSetCurrentWorksheet() { $index = 0; $title = 'Hello World'; - - // Setup all the mocks - $worksheetMock = $this->getMockBuilder('\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet')->disableOriginalConstructor()->getMock(); + $worksheetMock = $this->getMockBuilder(Worksheet::class)->disableOriginalConstructor()->getMock(); $worksheetMock->expects($this->once())->method('setTitle')->with($title); $this->spreadsheet->expects($this->once())->method('getActiveSheet')->willReturn($worksheetMock); $this->spreadsheet->expects($this->once())->method('createSheet')->with($index); @@ -71,7 +69,7 @@ public function testShouldSetCurrentWorksheet() $service = $this->buildService(); $service->setWorksheet($index, $title); - $this->assertAttributeEquals(1, 'currentRow', $service, 'Row should be reset to 1 when switching active sheets'); + $this->assertEquals(1, $service->getCurrentRow(), 'Row should be reset to 1 when switching active sheets'); } public function testShouldWriteSingleRowHeaders()