Skip to content

Commit

Permalink
Merge pull request #12 from courtney-miles/issue/11/AddPhp80Support
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
courtney-miles authored Jan 29, 2022
2 parents 8c7f701 + 514bd31 commit 335ee09
Show file tree
Hide file tree
Showing 61 changed files with 111 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.2', '7.3', '7.4']
php-version: ['7.2', '7.3', '7.4', '8.0']
composer-flag:
- '--prefer-dist'
# - '--prefer-stable --prefer-lowest'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ composer.phar
composer.lock
phpunit.xml
Vagrantfile
.php_cs.dist
.php_cs.dist
/.php-cs-fixer.cache
6 changes: 3 additions & 3 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

$finder = PhpCsFixer\Finder::create()
->in(__DIR__);
$config = PhpCsFixer\Config::create()
->setRules([
$config = new PhpCsFixer\Config();
$config->setRules([
'@PSR2' => true,
'@Symfony' => true,
'strict_param' => true,
Expand All @@ -19,4 +19,4 @@
])
->setFinder($finder);

return $config;
return $config;
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-cli
FROM php:8.0-cli

# system dependecies
RUN apt-get update && apt-get install -y \
Expand Down
1 change: 0 additions & 1 deletion PHPUnit/Framework/IndexTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use MilesAsylum\SchnoopSchema\MySQL\Constraint\IndexedColumn;
use MilesAsylum\SchnoopSchema\MySQL\Constraint\IndexInterface;
use MilesAsylum\SchnoopSchema\MySQL\Table\TableInterface;

abstract class IndexTestCase extends ConstraintTestCase
{
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
}
],
"require": {
"php" : "7.2 - 7.4",
"php" : "7.2 - 8.0",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit" : "^7.0",
"phpunit/phpunit" : ">=7.0",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/dbunit": "^4.0",
"friendsofphp/php-cs-fixer": "^2.18"
"friendsofphp/php-cs-fixer": "^3.0"
},
"autoload": {
"psr-4": {
Expand Down
32 changes: 17 additions & 15 deletions tests/SchnoopSchema/MySQL/Column/ColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
use MilesAsylum\SchnoopSchema\MySQL\DataType\SetType;
use MilesAsylum\SchnoopSchema\MySQL\DataType\TimestampType;
use MilesAsylum\SchnoopSchema\MySQL\DataType\TimeTypeInterface;
use MilesAsylum\SchnoopSchema\MySQL\Exception\LogicException;
use MilesAsylum\SchnoopSchema\PHPUnit\Framework\SchnoopSchemaTestCase;
use MilesAsylum\SchnoopSchema\MySQL\Column\Column;
use MilesAsylum\SchnoopSchema\MySQL\DataType\DataTypeInterface;
use MilesAsylum\SchnoopSchema\MySQL\DataType\NumericTypeInterface;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit\Framework\MockObject\MockObject;

class ColumnTest extends SchnoopSchemaTestCase
{
Expand All @@ -22,11 +23,11 @@ class ColumnTest extends SchnoopSchemaTestCase
protected $name = 'schnoop_col';

/**
* @var DataTypeInterface|PHPUnit_Framework_MockObject_MockObject
* @var DataTypeInterface|MockObject
*/
protected $dataType;

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

Expand Down Expand Up @@ -149,12 +150,11 @@ public function testNotHasDefaultWhenNotAllowDefaultAndAllowNull()
$this->assertNull($this->column->getDefault());
}

/**
* @expectedException \MilesAsylum\SchnoopSchema\MySQL\Exception\LogicException
* @expectedExceptionMessage Unable to set default value for the column. The data-type "FOO" does not support a default.
*/
public function testExceptionWhenSetDefaultWhenNotAllowed()
{
$this->expectExceptionMessage("Unable to set default value for the column. The data-type \"FOO\" does not support a default.");
$this->expectException(LogicException::class);

/** @var DataTypeInterface|PHPUnit_Framework_MockObject_MockObject $mockDataType */
$mockDataType = $this->createMock(DataTypeInterface::class);
$mockDataType->method('cast')
Expand All @@ -173,12 +173,13 @@ public function testExceptionWhenSetDefaultWhenNotAllowed()
$column->setDefault('foo');
}

/**
* @expectedException \MilesAsylum\SchnoopSchema\MySQL\Exception\LogicException
* @expectedExceptionMessage Data type "FOOTYPE" for column "schnoop_col" does not support setting current time on update.
*/
public function testExceptionWhenSetOnUpdateCurrentTimestapForUnsupportedDataType()
{
$this->expectExceptionMessage(
'Data type "FOOTYPE" for column "schnoop_col" does not support setting current time on update.'
);
$this->expectException(LogicException::class);

/** @var DataTypeInterface|PHPUnit_Framework_MockObject_MockObject $mockDataType */
$mockDataType = $this->createMock(DataTypeInterface::class);
$mockDataType->method('getType')
Expand Down Expand Up @@ -236,12 +237,13 @@ public function testSetAutoIncrement()
$this->assertTrue($column->isAutoIncrement());
}

/**
* @expectedException \MilesAsylum\SchnoopSchema\MySQL\Exception\LogicException
* @expectedExceptionMessage Unable to set auto-increment property on the column. Data-type "FOO" does not support an auto-incrementing value.
*/
public function testExceptionSetAutoIncrementOnUnsupportedType()
{
$this->expectExceptionMessage(
'Unable to set auto-increment property on the column. Data-type "FOO" does not support an auto-incrementing value.'
);
$this->expectException(LogicException::class);

$this->dataType->method('getType')
->willReturn('FOO');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AbstractConstraintTest extends ConstraintTestCase

protected $constraintType = ConstraintInterface::CONSTRAINT_INDEX;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/AbstractIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AbstractIndexTest extends IndexTestCase

protected $indexType = IndexInterface::INDEX_TYPE_BTREE;

public function setUp()
public function setUp(): void
{
$this->abstractIndex = $this->getMockForAbstractClass(
AbstractIndex::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ForeignKeyColumnTest extends TestCase
*/
protected $foreignKeyColumn;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/ForeignKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ForeignKeyTest extends ConstraintTestCase
*/
protected $foreignKey;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/FullTextIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FullTextIndexTest extends IndexTestCase

protected $fullTextIndex;

public function setUp()
public function setUp(): void
{
$this->fullTextIndex = new FullTextIndex($this->constraintName);

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IndexTest extends IndexTestCase

protected $indexedColumns = [];

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/IndexedColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class IndexedColumnTest extends SchnoopSchemaTestCase
*/
protected $indexedColumn;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/SpatialIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SpatialIndexTest extends IndexTestCase

protected $indexedColumns = [];

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/Constraint/UniqueIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UniqueIndexTest extends IndexTestCase

protected $indexedColumns = [];

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AbstractBinaryTypeTest extends BinaryTypeTestCase

protected $type = 'foo';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AbstractBlobTypeTest extends DataTypeTestCase

protected $type = 'foo';

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

Expand Down
6 changes: 3 additions & 3 deletions tests/SchnoopSchema/MySQL/DataType/AbstractCharTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use MilesAsylum\SchnoopSchema\MySQL\DataType\AbstractCharType;
use MilesAsylum\SchnoopSchema\PHPUnit\Framework\CharTypeTestCase;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit\Framework\MockObject\MockObject;

class AbstractCharTypeTest extends CharTypeTestCase
{
Expand All @@ -17,7 +17,7 @@ class AbstractCharTypeTest extends CharTypeTestCase

protected $length = 6;

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

Expand Down Expand Up @@ -47,7 +47,7 @@ public function testInitialProperties()

/**
* @param $type
* @return AbstractCharType|PHPUnit_Framework_MockObject_MockObject
* @return AbstractCharType|MockObject
*/
protected function createMockAbstractCharType($type)
{
Expand Down
6 changes: 3 additions & 3 deletions tests/SchnoopSchema/MySQL/DataType/AbstractIntTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use MilesAsylum\SchnoopSchema\PHPUnit\Framework\IntTypeTestCase;
use MilesAsylum\SchnoopSchema\MySQL\DataType\AbstractIntType;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit\Framework\MockObject\MockObject;

class AbstractIntTypeTest extends IntTypeTestCase
{
Expand All @@ -15,7 +15,7 @@ class AbstractIntTypeTest extends IntTypeTestCase

protected $type = 'foo';

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

Expand Down Expand Up @@ -60,7 +60,7 @@ public function DDLProvider()

/**
* @param string $type
* @return AbstractIntType|PHPUnit_Framework_MockObject_MockObject
* @return AbstractIntType|MockObject
*/
protected function createMockAbstractIntType($type)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use MilesAsylum\SchnoopSchema\PHPUnit\Framework\NumericPointTypeTestCase;
use MilesAsylum\SchnoopSchema\MySQL\DataType\AbstractNumericPointType;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit\Framework\MockObject\MockObject;

class AbstractNumericPointTypeTest extends NumericPointTypeTestCase
{
Expand All @@ -15,7 +15,7 @@ class AbstractNumericPointTypeTest extends NumericPointTypeTestCase

protected $type = 'foo';

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

Expand All @@ -40,7 +40,7 @@ public function testInitialProperties()

/**
* @param $type
* @return AbstractNumericPointType|PHPUnit_Framework_MockObject_MockObject
* @return AbstractNumericPointType|MockObject
*/
protected function createMockAbstractNumericPointType($type)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AbstractOptionsTypeTest extends OptionsTypeTestCase

protected $type = 'foo';

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

Expand Down
6 changes: 3 additions & 3 deletions tests/SchnoopSchema/MySQL/DataType/AbstractTextTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use MilesAsylum\SchnoopSchema\MySQL\DataType\AbstractBlobType;
use MilesAsylum\SchnoopSchema\MySQL\DataType\AbstractTextType;
use MilesAsylum\SchnoopSchema\PHPUnit\Framework\TextTypeTestCase;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit\Framework\MockObject\MockObject;

class AbstractTextTypeTest extends TextTypeTestCase
{
Expand All @@ -16,7 +16,7 @@ class AbstractTextTypeTest extends TextTypeTestCase

protected $type = 'foo';

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

Expand All @@ -41,7 +41,7 @@ public function testInitialProperties()

/**
* @param string $type
* @return AbstractTextType|PHPUnit_Framework_MockObject_MockObject
* @return AbstractTextType|MockObject
*/
protected function createMockAbstractTextType($type)
{
Expand Down
3 changes: 1 addition & 2 deletions tests/SchnoopSchema/MySQL/DataType/AbstractTimeTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

use MilesAsylum\SchnoopSchema\MySQL\DataType\AbstractTimeType;
use MilesAsylum\SchnoopSchema\PHPUnit\Framework\TimeTypeTestCase;
use PHPUnit_Framework_MockObject_MockObject;

class AbstractTimeTypeTest extends TimeTypeTestCase
{
protected $abstractTimeType;

protected $type = 'foo';

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/DataType/BigIntTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BigIntTypeTest extends IntTypeTestCase
*/
protected $bigIntType;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/SchnoopSchema/MySQL/DataType/BinaryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BinaryTypeTest extends BinaryTypeTestCase
*/
protected $binaryType;

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

Expand Down
Loading

0 comments on commit 335ee09

Please sign in to comment.