Skip to content

Commit

Permalink
Test case-bundle and PHPUnit 8 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
MisatoTremor committed Jul 17, 2019
1 parent b8b9604 commit 65a9f29
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class ConfigurationTest extends TestCase
{
public function testGetConfigTreeBuilder()
public function testGetConfigTreeBuilder(): void
{
$config = new Configuration();
$this->assertInstanceOf(TreeBuilder::class, $config->getConfigTreeBuilder());
Expand Down
6 changes: 3 additions & 3 deletions Tests/Doctrine/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ImporterTest extends TestCase
/**
* Setup test class.
*/
public function setUp()
public function setUp(): void
{
$caseConverter = $this->createMock(CaseConverter::class);
$caseConverter
Expand All @@ -51,7 +51,7 @@ public function setUp()
/**
* Test getHeaders.
*/
public function testGetHeaders()
public function testGetHeaders(): void
{
$this->importer->init(__DIR__.'/../import.csv', $this->class);
$this->assertEquals(
Expand All @@ -67,7 +67,7 @@ public function testGetHeaders()
/**
* Test getHeaders.
*/
public function testGetFormHeaders()
public function testGetFormHeaders(): void
{
$this->importer->init(__DIR__.'/../import.csv', $this->class, ',', 'form');
$this->assertEquals(
Expand Down
8 changes: 4 additions & 4 deletions Tests/Export/Doctrine/ORM/ExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ExporterTest extends TestCase
*/
protected $exporter;

public function setUp()
public function setUp(): void
{
$query = $this->getMockForAbstractClass(AbstractQuery::class, [], '', false, true, true, ['iterate', 'HYDRATE_ARRAY', 'getSQL', '_doExecute']);
$query
Expand Down Expand Up @@ -60,7 +60,7 @@ public function setUp()
/**
* Test init.
*/
public function testInit()
public function testInit(): void
{
$this->exporter->init(TestEntity::class);
$this->assertInstanceOf(QueryBuilder::class, $this->exporter->getQueryBuilder());
Expand All @@ -69,7 +69,7 @@ public function testInit()
/**
* Test convert row.
*/
public function testArrayToCsv()
public function testArrayToCsv(): void
{
$this->assertEquals(
'"val\'1","val,2","val""3"'."\n",
Expand All @@ -80,7 +80,7 @@ public function testArrayToCsv()
/**
* Test convert row.
*/
public function testGetContent()
public function testGetContent(): void
{
$expected = '"row 1","row 2","row 3"';
$expected .= "\n";
Expand Down
4 changes: 2 additions & 2 deletions Tests/Import/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ImporterTest extends TestCase
/**
* Setup test class.
*/
public function setUp()
public function setUp(): void
{
$fields = ['id', 'field1', 'field2'];
$assocs = ['assoc'];
Expand Down Expand Up @@ -88,7 +88,7 @@ static function ($value) use ($assocs) {
/**
* Test import.
*/
public function testImport()
public function testImport(): void
{
$this->importer->import($this->fields);
$this->assertEquals(
Expand Down
6 changes: 3 additions & 3 deletions Tests/TestEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getId()
return $this->id;
}

public function setId($id)
public function setId($id): void
{
$this->id = $id;
}
Expand All @@ -34,7 +34,7 @@ public function getField1()
return $this->field1;
}

public function setField1($field1)
public function setField1($field1): void
{
$this->field1 = $field1;
}
Expand All @@ -44,7 +44,7 @@ public function getField2()
return $this->field2;
}

public function setField2($field2)
public function setField2($field2): void
{
$this->field2 = $field2;
}
Expand Down
11 changes: 6 additions & 5 deletions Tests/Util/FieldRetrieverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Avro\CsvBundle\Tests\TestEntity;
use Avro\CsvBundle\Util\FieldRetriever;
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class FieldRetrieverTest extends TestCase
Expand All @@ -24,11 +25,11 @@ class FieldRetrieverTest extends TestCase
*/
protected $class;
/**
* @var CaseConverter|\PHPUnit_Framework_MockObject_MockObject
* @var CaseConverter|MockObject
*/
private $caseConverter;

public function setUp()
public function setUp(): void
{
$annotationReader = new AnnotationReader();
$this->caseConverter = $this->createMock(CaseConverter::class);
Expand All @@ -54,7 +55,7 @@ public function setUp()
$this->class = TestEntity::class;
}

public function testGetFields()
public function testGetFields(): void
{
$this->assertEquals(
$this->fieldRetriever->getFields($this->class),
Expand All @@ -69,7 +70,7 @@ public function testGetFields()
);
}

public function testGetFieldsAsCamelCase()
public function testGetFieldsAsCamelCase(): void
{
$this->assertEquals(
$this->fieldRetriever->getFields($this->class, 'camel'),
Expand All @@ -84,7 +85,7 @@ public function testGetFieldsAsCamelCase()
);
}

public function testGetFieldsAndCopyKeys()
public function testGetFieldsAndCopyKeys(): void
{
$this->assertEquals(
$this->fieldRetriever->getFields($this->class, 'camel', true),
Expand Down
12 changes: 6 additions & 6 deletions Tests/Util/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class ReaderTest extends TestCase
*/
protected $reader;

public function setUp()
public function setUp(): void
{
$this->reader = new Reader();
$this->reader->open(__DIR__.'/../import.csv');
}

public function testGetHeaders()
public function testGetHeaders(): void
{
$this->assertEquals(
[
Expand All @@ -35,7 +35,7 @@ public function testGetHeaders()
);
}

public function testGetRow()
public function testGetRow(): void
{
$this->assertEquals(
[
Expand Down Expand Up @@ -63,7 +63,7 @@ public function testGetRow()
);
}

public function testGetRows()
public function testGetRows(): void
{
$this->assertEquals(
[
Expand All @@ -82,8 +82,8 @@ public function testGetRows()
);
}

public function testGetAll()
public function testGetAll(): void
{
$this->assertEquals(3, count($this->reader->getAll()));
$this->assertCount(3, $this->reader->getAll());
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require": {
"php": "^7.2.0",
"ext-json": "*",
"avro/case-bundle": "*"
"misatotremor/case-bundle": "^0.4.1"
},
"require-dev": {
"twig/twig": "*",
Expand Down

0 comments on commit 65a9f29

Please sign in to comment.