Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
971b9b48
Unverified
Commit
971b9b48
authored
Jan 15, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked Type tests
parent
8f25277f
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
50 additions
and
67 deletions
+50
-67
phpstan.neon.dist
phpstan.neon.dist
+0
-3
ArrayTest.php
tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
+1
-2
BinaryTest.php
tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
+1
-2
BlobTest.php
tests/Doctrine/Tests/DBAL/Types/BlobTest.php
+1
-2
BooleanTest.php
tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
+14
-5
DateImmutableTypeTest.php
tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php
+1
-2
DateIntervalTest.php
tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php
+1
-4
DateTest.php
tests/Doctrine/Tests/DBAL/Types/DateTest.php
+2
-2
DateTimeImmutableTypeTest.php
...s/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php
+3
-4
DateTimeTest.php
tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
+2
-2
DateTimeTzImmutableTypeTest.php
...Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php
+1
-2
DateTimeTzTest.php
tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php
+2
-2
DecimalTest.php
tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
+1
-2
FloatTest.php
tests/Doctrine/Tests/DBAL/Types/FloatTest.php
+1
-2
GuidTypeTest.php
tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
+1
-2
IntegerTest.php
tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
+1
-2
JsonTest.php
tests/Doctrine/Tests/DBAL/Types/JsonTest.php
+1
-2
ObjectTest.php
tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
+1
-2
SmallIntTest.php
tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
+1
-2
StringTest.php
tests/Doctrine/Tests/DBAL/Types/StringTest.php
+1
-2
TimeImmutableTypeTest.php
tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php
+3
-4
TimeTest.php
tests/Doctrine/Tests/DBAL/Types/TimeTest.php
+2
-2
VarDateTimeImmutableTypeTest.php
...octrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php
+7
-8
VarDateTimeTest.php
tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
+1
-5
No files found.
phpstan.neon.dist
View file @
971b9b48
...
...
@@ -33,9 +33,6 @@ parameters:
# weird class name, represented in stubs as OCI_(Lob|Collection)
- '~unknown class OCI-(Lob|Collection)~'
# impossible inference for covariance
- '~^Property Doctrine\\Tests\\DBAL\\Types\\\S+Test::\$type \(Doctrine\\DBAL\\Types\\\S+Type\) does not accept Doctrine\\DBAL\\Types\\Type\.\z~'
# https://github.com/doctrine/dbal/pull/3582/files#r290847062
-
message: '~Parameter #3 \$type of method Doctrine\\DBAL\\Driver\\Statement::bindValue\(\) expects int, string given\.~'
...
...
tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
View file @
971b9b48
...
...
@@ -7,7 +7,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ArrayType
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
function
serialize
;
...
...
@@ -23,7 +22,7 @@ class ArrayTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'array'
);
$this
->
type
=
new
ArrayType
(
);
}
public
function
testArrayConvertsToDatabaseValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
View file @
971b9b48
...
...
@@ -8,7 +8,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\BinaryType
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -32,7 +31,7 @@ class BinaryTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'binary'
);
$this
->
type
=
new
BinaryType
(
);
}
public
function
testReturnsBindingType
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/BlobTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\BlobType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -24,7 +23,7 @@ class BlobTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'blob'
);
$this
->
type
=
new
BlobType
(
);
}
public
function
testBlobNullConvertsToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\BooleanType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -20,18 +19,28 @@ class BooleanTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
getMockForAbstractClass
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'boolean'
);
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
new
BooleanType
(
);
}
public
function
testBooleanConvertsToDatabaseValue
()
:
void
{
self
::
assertIsInt
(
$this
->
type
->
convertToDatabaseValue
(
1
,
$this
->
platform
));
$this
->
platform
->
expects
(
$this
->
once
())
->
method
(
'convertBooleansToDatabaseValue'
)
->
with
(
true
)
->
willReturn
(
1
);
self
::
assertSame
(
1
,
$this
->
type
->
convertToDatabaseValue
(
true
,
$this
->
platform
));
}
public
function
testBooleanConvertsToPHPValue
()
:
void
{
self
::
assertIsBool
(
$this
->
type
->
convertToPHPValue
(
0
,
$this
->
platform
));
$this
->
platform
->
expects
(
$this
->
once
())
->
method
(
'convertFromBoolean'
)
->
with
(
0
)
->
willReturn
(
false
);
self
::
assertFalse
(
$this
->
type
->
convertToPHPValue
(
0
,
$this
->
platform
));
}
public
function
testBooleanNullConvertsToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php
View file @
971b9b48
...
...
@@ -10,7 +10,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\DateImmutableType
;
use
Doctrine\DBAL\Types\Type
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\TestCase
;
use
function
get_class
;
...
...
@@ -25,8 +24,8 @@ class DateImmutableTypeTest extends TestCase
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'date_immutable'
);
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
new
DateImmutableType
();
}
public
function
testFactoryCreatesCorrectType
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php
View file @
971b9b48
...
...
@@ -9,7 +9,6 @@ use DateTime;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\DateIntervalType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
stdClass
;
...
...
@@ -28,9 +27,7 @@ final class DateIntervalTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'dateinterval'
);
self
::
assertInstanceOf
(
DateIntervalType
::
class
,
$this
->
type
);
$this
->
type
=
new
DateIntervalType
();
}
public
function
testDateIntervalConvertsToDatabaseValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/DateTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\DBAL\Types;
use
DateTime
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\
Date
Type
;
use
function
date_default_timezone_set
;
class
DateTest
extends
BaseDateTypeTestCase
...
...
@@ -16,7 +16,7 @@ class DateTest extends BaseDateTypeTestCase
*/
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'date'
);
$this
->
type
=
new
DateType
(
);
parent
::
setUp
();
}
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php
View file @
971b9b48
...
...
@@ -10,7 +10,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\DateTimeImmutableType
;
use
Doctrine\DBAL\Types\Type
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\TestCase
;
use
function
get_class
;
...
...
@@ -25,8 +24,8 @@ class DateTimeImmutableTypeTest extends TestCase
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'datetime_immutable'
);
$this
->
platform
=
$this
->
getMockBuilder
(
AbstractPlatform
::
class
)
->
getMock
();
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
new
DateTimeImmutableType
();
}
public
function
testFactoryCreatesCorrectType
()
:
void
...
...
@@ -46,7 +45,7 @@ class DateTimeImmutableTypeTest extends TestCase
public
function
testConvertsDateTimeImmutableInstanceToDatabaseValue
()
:
void
{
$date
=
$this
->
getMockBuilder
(
DateTimeImmutable
::
class
)
->
getMock
(
);
$date
=
$this
->
createMock
(
DateTimeImmutable
::
class
);
$this
->
platform
->
expects
(
$this
->
once
())
->
method
(
'getDateTimeFormatString'
)
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\DBAL\Types;
use
DateTime
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\
DateTime
Type
;
class
DateTimeTest
extends
BaseDateTypeTestCase
{
...
...
@@ -15,7 +15,7 @@ class DateTimeTest extends BaseDateTypeTestCase
*/
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'datetime'
);
$this
->
type
=
new
DateTimeType
(
);
parent
::
setUp
();
}
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php
View file @
971b9b48
...
...
@@ -10,7 +10,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\DateTimeTzImmutableType
;
use
Doctrine\DBAL\Types\Type
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\TestCase
;
use
function
get_class
;
...
...
@@ -25,8 +24,8 @@ class DateTimeTzImmutableTypeTest extends TestCase
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'datetimetz_immutable'
);
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
new
DateTimeTzImmutableType
();
}
public
function
testFactoryCreatesCorrectType
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\DBAL\Types;
use
DateTime
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\
DateTimeTz
Type
;
class
DateTimeTzTest
extends
BaseDateTypeTestCase
{
...
...
@@ -15,7 +15,7 @@ class DateTimeTzTest extends BaseDateTypeTestCase
*/
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'datetimetz'
);
$this
->
type
=
new
DateTimeTzType
(
);
parent
::
setUp
();
}
...
...
tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\DecimalType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -21,7 +20,7 @@ class DecimalTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'decimal'
);
$this
->
type
=
new
DecimalType
(
);
}
public
function
testDecimalConvertsToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/FloatTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -21,7 +20,7 @@ class FloatTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'float'
);
$this
->
type
=
new
FloatType
(
);
}
public
function
testFloatConvertsToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\GuidType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -21,7 +20,7 @@ class GuidTypeTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'guid'
);
$this
->
type
=
new
GuidType
(
);
}
public
function
testConvertToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\IntegerType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -21,7 +20,7 @@ class IntegerTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'integer'
);
$this
->
type
=
new
IntegerType
(
);
}
public
function
testIntegerConvertsToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/JsonTest.php
View file @
971b9b48
...
...
@@ -8,7 +8,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\JsonType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -29,7 +28,7 @@ class JsonTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'json'
);
$this
->
type
=
new
JsonType
(
);
}
public
function
testReturnsBindingType
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
View file @
971b9b48
...
...
@@ -7,7 +7,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\ObjectType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
stdClass
;
...
...
@@ -24,7 +23,7 @@ class ObjectTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'object'
);
$this
->
type
=
new
ObjectType
(
);
}
public
function
testObjectConvertsToDatabaseValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\SmallIntType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -21,7 +20,7 @@ class SmallIntTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'smallint'
);
$this
->
type
=
new
SmallIntType
(
);
}
public
function
testSmallIntConvertsToPHPValue
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/StringTest.php
View file @
971b9b48
...
...
@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\StringType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -21,7 +20,7 @@ class StringTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
Type
::
getType
(
'string'
);
$this
->
type
=
new
StringType
(
);
}
public
function
testReturnsSQLDeclaration
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php
View file @
971b9b48
...
...
@@ -10,7 +10,6 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\TimeImmutableType
;
use
Doctrine\DBAL\Types\Type
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\TestCase
;
use
function
get_class
;
...
...
@@ -25,8 +24,8 @@ class TimeImmutableTypeTest extends TestCase
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'time_immutable'
);
$this
->
platform
=
$this
->
getMockBuilder
(
AbstractPlatform
::
class
)
->
getMock
();
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
new
TimeImmutableType
();
}
public
function
testFactoryCreatesCorrectType
()
:
void
...
...
@@ -46,7 +45,7 @@ class TimeImmutableTypeTest extends TestCase
public
function
testConvertsDateTimeImmutableInstanceToDatabaseValue
()
:
void
{
$date
=
$this
->
getMockBuilder
(
DateTimeImmutable
::
class
)
->
getMock
(
);
$date
=
$this
->
createMock
(
DateTimeImmutable
::
class
);
$this
->
platform
->
expects
(
$this
->
once
())
->
method
(
'getTimeFormatString'
)
...
...
tests/Doctrine/Tests/DBAL/Types/TimeTest.php
View file @
971b9b48
...
...
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace
Doctrine\Tests\DBAL\Types
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\T
imeT
ype
;
class
TimeTest
extends
BaseDateTypeTestCase
{
...
...
@@ -14,7 +14,7 @@ class TimeTest extends BaseDateTypeTestCase
*/
protected
function
setUp
()
:
void
{
$this
->
type
=
Type
::
getType
(
'time'
);
$this
->
type
=
new
TimeType
(
);
parent
::
setUp
();
}
...
...
tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php
View file @
971b9b48
...
...
@@ -9,7 +9,6 @@ use DateTimeImmutable;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\VarDateTimeImmutableType
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
PHPUnit\Framework\TestCase
;
...
...
@@ -24,12 +23,8 @@ class VarDateTimeImmutableTypeTest extends TestCase
protected
function
setUp
()
:
void
{
if
(
!
Type
::
hasType
(
'vardatetime_immutable'
))
{
Type
::
addType
(
'vardatetime_immutable'
,
VarDateTimeImmutableType
::
class
);
}
$this
->
type
=
Type
::
getType
(
'vardatetime_immutable'
);
$this
->
platform
=
$this
->
getMockForAbstractClass
(
AbstractPlatform
::
class
);
$this
->
platform
=
$this
->
createMock
(
AbstractPlatform
::
class
);
$this
->
type
=
new
VarDateTimeImmutableType
();
}
public
function
testReturnsName
()
:
void
...
...
@@ -44,7 +39,11 @@ class VarDateTimeImmutableTypeTest extends TestCase
public
function
testConvertsDateTimeImmutableInstanceToDatabaseValue
()
:
void
{
$date
=
$this
->
getMockBuilder
(
DateTimeImmutable
::
class
)
->
getMock
();
$this
->
platform
->
expects
(
$this
->
any
())
->
method
(
'getDateTimeFormatString'
)
->
will
(
$this
->
returnValue
(
'Y-m-d H:i:s'
));
$date
=
$this
->
createMock
(
DateTimeImmutable
::
class
);
$date
->
expects
(
$this
->
once
())
->
method
(
'format'
)
...
...
tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
View file @
971b9b48
...
...
@@ -7,7 +7,6 @@ namespace Doctrine\Tests\DBAL\Types;
use
DateTime
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\VarDateTimeType
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
...
...
@@ -27,10 +26,7 @@ class VarDateTimeTest extends DbalTestCase
->
method
(
'getDateTimeFormatString'
)
->
will
(
$this
->
returnValue
(
'U'
));
if
(
!
Type
::
hasType
(
'vardatetime'
))
{
Type
::
addType
(
'vardatetime'
,
VarDateTimeType
::
class
);
}
$this
->
type
=
Type
::
getType
(
'vardatetime'
);
$this
->
type
=
new
VarDateTimeType
();
}
public
function
testDateTimeConvertsToDatabaseValue
()
:
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment