-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from activecollab/mixed-improvement
Mixed improvement
- Loading branch information
Showing
14 changed files
with
162 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab ID project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
$header = <<<EOF | ||
This file is part of the Active Collab DateValue project. | ||
(c) A51 doo <[email protected]>. All rights reserved. | ||
EOF; | ||
|
||
Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header); | ||
|
||
return (new Symfony\CS\Config\Config('psr2'))->fixers([ | ||
'header_comment', | ||
'array_element_no_space_before_comma', | ||
'array_element_white_space_after_comma', | ||
'double_arrow_multiline_whitespaces', | ||
'hash_to_slash_comment', | ||
'include', | ||
'join_function', | ||
'multiline_array_trailing_comma', | ||
'namespace_no_leading_whitespace', | ||
'no_blank_lines_after_class_opening ', | ||
'no_empty_lines_after_phpdocs', | ||
'phpdoc_scalar', | ||
'phpdoc_short_description', | ||
'self_accessor', | ||
'single_array_no_trailing_comma', | ||
'single_blank_line_before_namespace', | ||
'spaces_after_semicolon', | ||
'spaces_before_semicolon', | ||
'spaces_cast', | ||
'standardize_not_equal', | ||
'ternary_spaces', | ||
'trim_array_spaces', | ||
'unused_use', | ||
'whitespacy_lines', | ||
'ordered_use', | ||
'short_array_syntax', | ||
'phpdoc_params', | ||
'-phpdoc_separation', | ||
'-phpdoc_no_package', | ||
'-print_to_echo', | ||
'-concat_without_spaces', | ||
'-empty_return', | ||
])->finder((new Symfony\CS\Finder\DefaultFinder())->in([__DIR__ . '/src', __DIR__ . '/test'])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ php: | |
- 5.6 | ||
- '7' | ||
install: composer install --dev | ||
script: phpunit -c test/phpunit.xml | ||
script: phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<phpunit bootstrap="./test/bootstrap.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
syntaxCheck="false" | ||
processIsolation="false" | ||
colors="true"> | ||
<testsuites> | ||
<testsuite name="DateFile"> | ||
<directory>./test/src</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue; | ||
|
||
use Carbon\Carbon; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue; | ||
|
||
use DateTimeInterface; | ||
use JsonSerializable; | ||
|
||
/** | ||
* @package ActiveCollab\DateValue | ||
*/ | ||
interface DateTimeValueInterface extends \DateTimeInterface, \JsonSerializable | ||
interface DateTimeValueInterface extends DateTimeInterface, JsonSerializable | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue; | ||
|
||
use Carbon\Carbon; | ||
|
@@ -12,7 +18,7 @@ class DateValue extends Carbon implements DateValueInterface | |
/** | ||
* Create a new DateValue instance. | ||
* | ||
* @param string $time | ||
* @param string $time | ||
* @param \DateTimeZone|string $tz | ||
*/ | ||
public function __construct($time = null, $tz = null) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue; | ||
|
||
use DateTimeInterface; | ||
use JsonSerializable; | ||
|
||
/** | ||
* @package ActiveCollab\DateValue | ||
*/ | ||
interface DateValueInterface extends \DateTimeInterface, \JsonSerializable | ||
interface DateValueInterface extends DateTimeInterface, JsonSerializable | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
defined('BASE_PATH') || define('BASE_PATH', realpath(__DIR__)); | ||
date_default_timezone_set('GMT'); | ||
|
||
require dirname(__DIR__).'/vendor/autoload.php'; | ||
require __DIR__.'/src/TestCase.php'; | ||
require __DIR__.'/src/TestCase/TestCase.php'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue\Test; | ||
|
||
use ActiveCollab\DateValue\DateValueInterface; | ||
use ActiveCollab\DateValue\DateValue; | ||
use ActiveCollab\DateValue\DateTimeValueInterface; | ||
use ActiveCollab\DateValue\DateTimeValue; | ||
use ActiveCollab\DateValue\DateTimeValueInterface; | ||
use ActiveCollab\DateValue\DateValue; | ||
use ActiveCollab\DateValue\DateValueInterface; | ||
use ActiveCollab\DateValue\Test\TestCase\TestCase; | ||
use ReflectionClass; | ||
|
||
/** | ||
|
@@ -14,7 +21,7 @@ | |
class ClassesTest extends TestCase | ||
{ | ||
/** | ||
* Test if date value class exists | ||
* Test if date value class exists. | ||
*/ | ||
public function testDateValueClass() | ||
{ | ||
|
@@ -23,11 +30,11 @@ public function testDateValueClass() | |
} | ||
|
||
/** | ||
* Test if date time value class exists | ||
* Test if date time value class exists. | ||
*/ | ||
public function testDateTimeValueClass() | ||
{ | ||
$this->assertTrue(class_exists(DateTimeValue::class, true)); | ||
$this->assertTrue((new ReflectionClass(DateTimeValue::class))->implementsInterface(DateTimeValueInterface::class)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue\Test; | ||
|
||
use ActiveCollab\DateValue\DateValue; | ||
use ActiveCollab\DateValue\DateTimeValue; | ||
use ActiveCollab\DateValue\DateValue; | ||
use ActiveCollab\DateValue\Test\TestCase\TestCase; | ||
|
||
/** | ||
* @package ActiveCollab\DateValue\Test | ||
|
@@ -16,7 +23,7 @@ class JsonSerializeTest extends TestCase | |
private $reference; | ||
|
||
/** | ||
* Set up test environment | ||
* Set up test environment. | ||
*/ | ||
public function setUp() | ||
{ | ||
|
@@ -28,7 +35,7 @@ public function setUp() | |
} | ||
|
||
/** | ||
* Tear down test environment | ||
* Tear down test environment. | ||
*/ | ||
public function tearDown() | ||
{ | ||
|
@@ -38,7 +45,7 @@ public function tearDown() | |
} | ||
|
||
/** | ||
* Test date serialization | ||
* Test date serialization. | ||
*/ | ||
public function testSerializeDate() | ||
{ | ||
|
@@ -54,7 +61,7 @@ public function testSerializeDate() | |
} | ||
|
||
/** | ||
* Test date time serialization | ||
* Test date time serialization. | ||
*/ | ||
public function testSerializeDateTime() | ||
{ | ||
|
@@ -65,4 +72,4 @@ public function testSerializeDateTime() | |
|
||
$this->assertEquals($this->reference->getTimestamp(), json_decode(json_encode(new DateTimeValue()), true)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue\Test; | ||
|
||
use ActiveCollab\DateValue\DateValueInterface; | ||
use ActiveCollab\DateValue\DateValue; | ||
use ActiveCollab\DateValue\DateTimeValueInterface; | ||
use ActiveCollab\DateValue\DateTimeValue; | ||
use ReflectionClass; | ||
use ActiveCollab\DateValue\DateValue; | ||
use ActiveCollab\DateValue\Test\TestCase\TestCase; | ||
|
||
/** | ||
* @package ActiveCollab\DateValue\Test | ||
*/ | ||
class NowTest extends TestCase | ||
{ | ||
/** | ||
* Test if now uses current timestamp | ||
* Test if now uses current timestamp. | ||
*/ | ||
public function testRealNow() | ||
{ | ||
$this->assertEquals((new DateTimeValue())->format('Y-m-d H:i:s'), date('Y-m-d H:i:s')); | ||
} | ||
|
||
/** | ||
* Test if now can be overriden, for test purposes | ||
* Test if now can be overriden, for test purposes. | ||
*/ | ||
public function testTestNow() | ||
{ | ||
DateTimeValue::setTestNow(new DateTimeValue('2013-10-02 11:18:32')); | ||
|
||
$this->assertEquals((new DateTimeValue())->format('Y-m-d H:i:s'), date('2013-10-02 11:18:32')); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Active Collab DateValue project. | ||
* | ||
* (c) A51 doo <[email protected]>. All rights reserved. | ||
*/ | ||
|
||
namespace ActiveCollab\DateValue\Test\TestCase; | ||
|
||
use PHPUnit_Framework_TestCase; | ||
|
||
abstract class TestCase extends PHPUnit_Framework_TestCase | ||
{ | ||
} |