Skip to content

Commit

Permalink
Merge pull request #13 from courtney-miles/task/FixCodeStyle
Browse files Browse the repository at this point in the history
Task/fix code style
  • Loading branch information
courtney-miles authored Jan 29, 2022
2 parents 335ee09 + f38ebca commit 2af7968
Show file tree
Hide file tree
Showing 189 changed files with 1,625 additions and 945 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Install Composer dependencies
run: composer update ${{ matrix.composer-flag }} --no-interaction --no-progress

# - name: Run Code Style Check for PHP ${{ matrix.php-version }}
# run: composer run-script style-check
- name: Run Code Style Check for PHP ${{ matrix.php-version }}
run: composer run-script style-check

- name: Run tests for PHP ${{ matrix.php-version }}
run: composer run-script test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ phpunit.xml
Vagrantfile
.php_cs.dist
/.php-cs-fixer.cache
/.phpunit.result.cache
6 changes: 4 additions & 2 deletions PHPUnit/Framework/BinaryTypeTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MilesAsylum\SchnoopSchema\PHPUnit\Framework;

use MilesAsylum\SchnoopSchema\MySQL\DataType\BinaryTypeInterface;
Expand All @@ -11,7 +13,7 @@ abstract class BinaryTypeTestCase extends DataTypeTestCase
*/
abstract protected function getBinaryType();

public function testSetLength()
public function testSetLength(): void
{
$binaryType = $this->getBinaryType();

Expand All @@ -21,7 +23,7 @@ public function testSetLength()
$this->assertSame(3, $binaryType->getLength());
}

public function testCast()
public function testCast(): void
{
$binaryType = $this->getBinaryType();

Expand Down
16 changes: 9 additions & 7 deletions PHPUnit/Framework/CharTypeTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MilesAsylum\SchnoopSchema\PHPUnit\Framework;

use MilesAsylum\SchnoopSchema\MySQL\DataType\CharTypeInterface;
Expand All @@ -18,7 +20,7 @@ abstract protected function createCharType();

abstract protected function getInitialLength();

public function testInitialProperties()
public function testInitialProperties(): void
{
$charType = $this->getCharType();

Expand All @@ -31,15 +33,15 @@ public function testInitialProperties()
$this->assertTrue($charType->doesAllowDefault());
}

public function testSetNewLength()
public function testSetNewLength(): void
{
$charType = $this->getCharType();
$charType->setLength(12);

$this->assertSame(12, $charType->getLength());
}

public function testSetCollation()
public function testSetCollation(): void
{
$collation = 'utf8mb4_general_ci';
$charType = $this->getCharType();
Expand All @@ -49,7 +51,7 @@ public function testSetCollation()
$this->assertSame($collation, $charType->getCollation());
}

public function testCast()
public function testCast(): void
{
$charType = $this->getCharType();

Expand All @@ -68,12 +70,12 @@ public function DDLProvider()
return [
[
strtoupper($charType->getType()) . "($length)",
$charType
$charType,
],
[
strtoupper($charType->getType()) . "($length) COLLATE '$collation'",
$charTypeCollate
]
$charTypeCollate,
],
];
}
}
8 changes: 5 additions & 3 deletions PHPUnit/Framework/ConstraintTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MilesAsylum\SchnoopSchema\PHPUnit\Framework;

use MilesAsylum\SchnoopSchema\MySQL\Constraint\ConstraintInterface;
Expand All @@ -15,7 +17,7 @@ abstract protected function getConstraintName();

abstract protected function getConstraintType();

public function testInitialProperties()
public function testInitialProperties(): void
{
$constraint = $this->getConstraint();

Expand All @@ -33,7 +35,7 @@ public function testInitialProperties()
$this->assertNull($constraint->getDatabaseName(), 'Assertion on ' . get_class($constraint));
}

public function testSetTableName()
public function testSetTableName(): void
{
$tableName = 'schnoop_tbl';
$constraint = $this->getConstraint();
Expand All @@ -43,7 +45,7 @@ public function testSetTableName()
$this->assertSame($tableName, $constraint->getTableName(), 'Assertion on ' . get_class($constraint));
}

public function testSetDatabaseName()
public function testSetDatabaseName(): void
{
$databaseName = 'schnoop_db';
$constraint = $this->getConstraint();
Expand Down
9 changes: 6 additions & 3 deletions PHPUnit/Framework/DataTypeTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MilesAsylum\SchnoopSchema\PHPUnit\Framework;

use MilesAsylum\SchnoopSchema\MySQL\DataType\DataTypeInterface;
Expand All @@ -8,17 +10,18 @@ abstract class DataTypeTestCase extends SchnoopSchemaTestCase
{
/**
* @see testDDL
*
* @return array
*/
abstract public function DDLProvider();

/**
* @dataProvider DDLProvider
*
* @param $expectedDDL
* @param DataTypeInterface $intType
*/
public function testDDL($expectedDDL, DataTypeInterface $intType)
public function testDDL($expectedDDL, DataTypeInterface $intType): void
{
$this->assertSame($expectedDDL, (string)$intType);
$this->assertSame($expectedDDL, (string) $intType);
}
}
31 changes: 16 additions & 15 deletions PHPUnit/Framework/IndexTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MilesAsylum\SchnoopSchema\PHPUnit\Framework;

use MilesAsylum\SchnoopSchema\MySQL\Constraint\IndexedColumn;
Expand All @@ -19,7 +21,7 @@ protected function getConstraint()
return $this->getIndex();
}

public function testInitialProperties()
public function testInitialProperties(): void
{
parent::testInitialProperties();

Expand All @@ -34,7 +36,7 @@ public function testInitialProperties()
$this->assertNull($index->getComment(), 'Assertion on ' . get_class($index));
}

public function testSetIndexedColumns()
public function testSetIndexedColumns(): void
{
$indexedColumnA = $this->createMock(IndexedColumn::class);
$indexedColumnA->method('getColumnName')->willReturn('col_a');
Expand All @@ -43,7 +45,7 @@ public function testSetIndexedColumns()

$indexedColumns = [
$indexedColumnA,
$indexedColumnB
$indexedColumnB,
];

$index = $this->getConstraint();
Expand All @@ -53,7 +55,7 @@ public function testSetIndexedColumns()
$this->assertSame($indexedColumns, $index->getIndexedColumns());
}

public function testSetIndexedColumnsReplacesPreviouslySetColumns()
public function testSetIndexedColumnsReplacesPreviouslySetColumns(): void
{
$indexedColumnA = $this->createMock(IndexedColumn::class);
$indexedColumnA->method('getColumnName')->willReturn('col_a');
Expand All @@ -64,12 +66,12 @@ public function testSetIndexedColumnsReplacesPreviouslySetColumns()

$indexedColumnsFirstSet = [
$indexedColumnA,
$indexedColumnB
$indexedColumnB,
];

$indexedColumnsSecondSet = [
$indexedColumnB,
$indexedColumnC
$indexedColumnC,
];

$index = $this->getConstraint();
Expand All @@ -79,7 +81,7 @@ public function testSetIndexedColumnsReplacesPreviouslySetColumns()
$this->assertSame($indexedColumnsSecondSet, $index->getIndexedColumns());
}

public function testAddIndexedColumns()
public function testAddIndexedColumns(): void
{
$indexedColumnA = $this->createMock(IndexedColumn::class);
$indexedColumnA->method('getColumnName')->willReturn('col_a');
Expand All @@ -88,7 +90,7 @@ public function testAddIndexedColumns()

$indexedColumns = [
$indexedColumnA,
$indexedColumnB
$indexedColumnB,
];

$index = $this->getConstraint();
Expand All @@ -99,7 +101,7 @@ public function testAddIndexedColumns()
$this->assertSame($indexedColumns, $index->getIndexedColumns());
}

public function testGetIndexedColumnNames()
public function testGetIndexedColumnNames(): void
{
$indexedColumnA = $this->createMock(IndexedColumn::class);
$indexedColumnA->method('getColumnName')->willReturn('col_a');
Expand All @@ -108,7 +110,7 @@ public function testGetIndexedColumnNames()

$indexedColumns = [
$indexedColumnA,
$indexedColumnB
$indexedColumnB,
];

$index = $this->getConstraint();
Expand All @@ -117,7 +119,7 @@ public function testGetIndexedColumnNames()
$this->assertSame(['col_a', 'col_b'], $index->getIndexedColumnNames());
}

public function testSetComment()
public function testSetComment(): void
{
$comment = 'Schnoop comment';
$index = $this->getIndex();
Expand All @@ -127,7 +129,7 @@ public function testSetComment()
$this->assertSame($comment, $index->getComment(), 'Assertion on ' . get_class($index));
}

protected function indexDDLAsserts($ddlPrefix)
protected function indexDDLAsserts($ddlPrefix): void
{
$index = $this->getIndex();

Expand All @@ -138,7 +140,7 @@ protected function indexDDLAsserts($ddlPrefix)

$indexedColumns = [
$indexedColumnA,
$indexedColumnB
$indexedColumnB,
];

$index->setIndexedColumns($indexedColumns);
Expand All @@ -150,7 +152,6 @@ protected function indexDDLAsserts($ddlPrefix)
{$ddlPrefix} (`col_a`,`col_b`) COMMENT '$comment'
SQL;


$this->assertSame($expectedDDL, (string)$index);
$this->assertSame($expectedDDL, (string) $index);
}
}
10 changes: 6 additions & 4 deletions PHPUnit/Framework/IntTypeTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace MilesAsylum\SchnoopSchema\PHPUnit\Framework;

use MilesAsylum\SchnoopSchema\MySQL\DataType\IntTypeInterface;
Expand All @@ -11,7 +13,7 @@ abstract class IntTypeTestCase extends DataTypeTestCase
*/
abstract protected function getIntType();

public function testInitialProperties()
public function testInitialProperties(): void
{
$intType = $this->getIntType();

Expand All @@ -22,7 +24,7 @@ public function testInitialProperties()
$this->assertFalse($intType->isZeroFill());
}

public function testSetDisplayWidth()
public function testSetDisplayWidth(): void
{
$displayWidth = 2;
$intType = $this->getIntType();
Expand All @@ -32,15 +34,15 @@ public function testSetDisplayWidth()
$this->assertSame($displayWidth, $intType->getDisplayWidth());
}

public function testZeroFill()
public function testZeroFill(): void
{
$intType = $this->getIntType();
$intType->setZeroFill(true);

$this->assertTrue($intType->isZeroFill());
}

public function testCast()
public function testCast(): void
{
$intType = $this->getIntType();

Expand Down
Loading

0 comments on commit 2af7968

Please sign in to comment.