Skip to content

Commit

Permalink
Fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Sep 4, 2021
1 parent 1940212 commit 1cc34f2
Show file tree
Hide file tree
Showing 23 changed files with 133 additions and 133 deletions.
4 changes: 2 additions & 2 deletions src/Test/AbstractTypedWriterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ protected function setUp(): void

final public function testFormatIsString(): void
{
$this->assertIsString($this->writer->getFormat());
static::assertIsString($this->writer->getFormat());
}

final public function testDefaultMimeTypeIsString(): void
{
$this->assertIsString($this->writer->getDefaultMimeType());
static::assertIsString($this->writer->getDefaultMimeType());
}

abstract protected function getWriter(): TypedWriterInterface;
Expand Down
14 changes: 7 additions & 7 deletions tests/ExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public function testConstructorRejectsNonTypedWriters(): void
public function testGetAvailableFormats(): void
{
$writer = $this->createMock('Sonata\Exporter\Writer\TypedWriterInterface');
$writer->expects($this->once())
$writer->expects(static::once())
->method('getFormat')
->willReturn('whatever');
$exporter = new Exporter([$writer]);
$this->assertSame(['whatever'], $exporter->getAvailableFormats());
static::assertSame(['whatever'], $exporter->getAvailableFormats());
}

/**
Expand All @@ -60,10 +60,10 @@ public function testGetResponse($format, $filename, $contentType, $expectedOutpu
['foo' => 'bar'],
]);
$writer = $this->createMock('Sonata\Exporter\Writer\TypedWriterInterface');
$writer->expects($this->any())
$writer->expects(static::any())
->method('getFormat')
->willReturn('made-up');
$writer->expects($this->any())
$writer->expects(static::any())
->method('getDefaultMimeType')
->willReturn('application/made-up');

Expand All @@ -76,9 +76,9 @@ public function testGetResponse($format, $filename, $contentType, $expectedOutpu
]);
$response = $exporter->getResponse($format, $filename, $source);

$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
$this->assertSame($contentType, $response->headers->get('Content-Type'));
$this->assertSame('attachment; filename="'.$filename.'"', $response->headers->get('Content-Disposition'));
static::assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
static::assertSame($contentType, $response->headers->get('Content-Type'));
static::assertSame('attachment; filename="'.$filename.'"', $response->headers->get('Content-Disposition'));
$this->expectOutputRegex($expectedOutput);
$response->sendContent();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function testHandler(): void
{
$source = $this->createMock('Sonata\Exporter\Source\SourceIteratorInterface');
$writer = $this->createMock('Sonata\Exporter\Writer\WriterInterface');
$writer->expects($this->once())->method('open');
$writer->expects($this->once())->method('close');
$writer->expects(static::once())->method('open');
$writer->expects(static::once())->method('close');

$exporter = new Handler($source, $writer);
$exporter->export();
Expand Down
2 changes: 1 addition & 1 deletion tests/Source/AbstractPropertySourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getValue($value)
}
};

$this->assertSame($expected, $iterator->getValue($value));
static::assertSame($expected, $iterator->getValue($value));
}

public function getValueProvider()
Expand Down
4 changes: 2 additions & 2 deletions tests/Source/ArraySourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function testHandler(): void
$iterator = new ArraySourceIterator($data);

foreach ($iterator as $value) {
$this->assertIsArray($value);
$this->assertCount(3, $value);
static::assertIsArray($value);
static::assertCount(3, $value);
}
}
}
32 changes: 16 additions & 16 deletions tests/Source/CsvSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public function testHandler(): void

$i = 0;
foreach ($iterator as $value) {
$this->assertIsArray($value);
$this->assertCount(2, $value);
$this->assertSame($i, $iterator->key());
static::assertIsArray($value);
static::assertCount(2, $value);
static::assertSame($i, $iterator->key());
$keys = array_keys($value);
$this->assertSame('firstname', $keys[0]);
$this->assertSame('name', $keys[1]);
static::assertSame('firstname', $keys[0]);
static::assertSame('name', $keys[1]);
++$i;
}
$this->assertSame(3, $i);
static::assertSame(3, $i);
}

public function testNoHeaders(): void
Expand All @@ -65,12 +65,12 @@ public function testNoHeaders(): void

$i = 0;
foreach ($iterator as $value) {
$this->assertIsArray($value);
$this->assertCount(2, $value);
$this->assertSame($i, $iterator->key());
static::assertIsArray($value);
static::assertCount(2, $value);
static::assertSame($i, $iterator->key());
++$i;
}
$this->assertSame(4, $i);
static::assertSame(4, $i);
}

public function testRewind(): void
Expand All @@ -79,18 +79,18 @@ public function testRewind(): void

$i = 0;
foreach ($iterator as $value) {
$this->assertIsArray($value);
$this->assertCount(2, $value);
static::assertIsArray($value);
static::assertCount(2, $value);
++$i;
}
$this->assertSame(3, $i);
static::assertSame(3, $i);

$i = 0;
foreach ($iterator as $value) {
$this->assertIsArray($value);
$this->assertCount(2, $value);
static::assertIsArray($value);
static::assertCount(2, $value);
++$i;
}
$this->assertSame(3, $i);
static::assertSame(3, $i);
}
}
4 changes: 2 additions & 2 deletions tests/Source/DoctrineODMQuerySourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class DoctrineODMQuerySourceIteratorTest extends TestCase
protected function setUp(): void
{
if (!\extension_loaded('mongodb')) {
$this->markTestSkipped('The mongodb extension is not available.');
static::markTestSkipped('The mongodb extension is not available.');
}

$this->dm = DocumentManager::create(null, $this->createConfiguration());
Expand Down Expand Up @@ -56,7 +56,7 @@ public function testHandler(): void

$iterator = new DoctrineODMQuerySourceIterator($query, ['id']);

$this->assertCount(3, iterator_to_array($iterator));
static::assertCount(3, iterator_to_array($iterator));
}

private function createConfiguration(): Configuration
Expand Down
4 changes: 2 additions & 2 deletions tests/Source/DoctrineORMQuerySourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class DoctrineORMQuerySourceIteratorTest extends TestCase
protected function setUp(): void
{
if (!\extension_loaded('pdo_sqlite') || !class_exists(Driver\PDO\SQLite\Driver::class)) {
$this->markTestSkipped('The sqlite extension is not available.');
static::markTestSkipped('The sqlite extension is not available.');
}

$this->em = EntityManager::create($this->createConnection(), $this->createConfiguration());
Expand Down Expand Up @@ -72,7 +72,7 @@ public function testEntityManagerClear(): void
$iterator = new DoctrineORMQuerySourceIterator($query, ['id'], 'r', $batchSize);

foreach ($iterator as $i => $item) {
$this->assertSame(0 === $i % $batchSize ? 0 : $i, $this->em->getUnitOfWork()->size());
static::assertSame(0 === $i % $batchSize ? 0 : $i, $this->em->getUnitOfWork()->size());
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Source/IteratorCallbackSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ public function testTransformer(): void
$result = [1, 2, 4, 8];

foreach ($this->sourceIterator as $key => $value) {
$this->assertSame([$result[$key]], $value);
static::assertSame([$result[$key]], $value);
}
}

public function testExtends(): void
{
$this->assertInstanceOf('Sonata\Exporter\Source\IteratorSourceIterator', $this->sourceIterator);
static::assertInstanceOf('Sonata\Exporter\Source\IteratorSourceIterator', $this->sourceIterator);
}

public function testGetIterator(): void
{
$this->assertSame($this->iterator, $this->sourceIterator->getIterator());
static::assertSame($this->iterator, $this->sourceIterator->getIterator());
}
}
18 changes: 9 additions & 9 deletions tests/Source/IteratorSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ protected function setUp(): void

public function testGetIterator(): void
{
self::assertSame($this->iterator, $this->sourceIterator->getIterator());
static::assertSame($this->iterator, $this->sourceIterator->getIterator());
}

public function testCurrent(): void
{
$this->iterator
->expects(self::once())
->expects(static::once())
->method('current')
->willReturn(['current']);

self::assertSame(['current'], $this->sourceIterator->current());
static::assertSame(['current'], $this->sourceIterator->current());
}

public function testNext(): void
{
$this->iterator
->expects(self::once())
->expects(static::once())
->method('next');

$this->sourceIterator->next();
Expand All @@ -60,27 +60,27 @@ public function testNext(): void
public function testKey(): void
{
$this->iterator
->expects(self::once())
->expects(static::once())
->method('key')
->willReturn('key');

self::assertSame('key', $this->sourceIterator->key());
static::assertSame('key', $this->sourceIterator->key());
}

public function testValid(): void
{
$this->iterator
->expects(self::once())
->expects(static::once())
->method('valid')
->willReturn(true);

self::assertTrue($this->sourceIterator->valid());
static::assertTrue($this->sourceIterator->valid());
}

public function testRewind(): void
{
$this->iterator
->expects(self::once())
->expects(static::once())
->method('rewind');

$this->sourceIterator->rewind();
Expand Down
4 changes: 2 additions & 2 deletions tests/Source/PDOStatementSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function setUp(): void
$this->pathToDb = tempnam(sys_get_temp_dir(), 'Sonata_exporter_');

if (!\in_array('sqlite', \PDO::getAvailableDrivers(), true)) {
$this->markTestSkipped('the sqlite extension is not available');
static::markTestSkipped('the sqlite extension is not available');
}

if (is_file($this->pathToDb)) {
Expand Down Expand Up @@ -77,6 +77,6 @@ public function testHandler(): void
$data[] = $user;
}

$this->assertCount(3, $data);
static::assertCount(3, $data);
}
}
10 changes: 5 additions & 5 deletions tests/Source/PropelCollectionSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PropelCollectionSourceIteratorTest extends TestCase
protected function setUp(): void
{
if (!class_exists('PropelCollection')) {
$this->markTestIncomplete('Propel is not available');
static::markTestIncomplete('Propel is not available');
}

$data = [
Expand All @@ -45,14 +45,14 @@ public function testIterator(): void
{
$data = $this->extract($this->collection, ['id' => '[id]', 'name' => '[name]']);

$this->assertCount(3, $data);
static::assertCount(3, $data);
}

public function testFieldsExtraction(): void
{
$data = $this->extract($this->collection, ['id' => '[id]', 'name' => '[name]']);

$this->assertSame([
static::assertSame([
[
'id' => 1,
'name' => 'john',
Expand All @@ -73,8 +73,8 @@ public function testDateTimeTransformation(): void
$data = $this->extract($this->collection, ['id' => '[id]', 'created_at' => '[created_at]']);

foreach ($data as $row) {
$this->assertArrayHasKey('created_at', $row);
$this->assertIsString($row['created_at']);
static::assertArrayHasKey('created_at', $row);
static::assertIsString($row['created_at']);
}
}

Expand Down

0 comments on commit 1cc34f2

Please sign in to comment.