-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#13438] - Added more tests for the Json formatter
- Loading branch information
Showing
4 changed files
with
158 additions
and
2 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
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,42 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <team@phalconphp.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Phalcon\Test\Unit\Logger\Formatter\Json; | ||
|
||
use Phalcon\Logger\Formatter\Json; | ||
use UnitTester; | ||
|
||
/** | ||
* Class GetDateFormatCest | ||
* | ||
* @package Phalcon\Test\Unit\Logger | ||
*/ | ||
class GetDateFormatCest | ||
{ | ||
/** | ||
* Tests Phalcon\Logger\Formatter\Json :: getDateFormat() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <team@phalconphp.com> | ||
* @since 2018-11-13 | ||
*/ | ||
public function loggerFormatterJsonGetDateFormat(UnitTester $I) | ||
{ | ||
$I->wantToTest("Logger\Formatter\Json - getDateFormat()"); | ||
$formatter = new Json(); | ||
|
||
$expected = 'D, d M y H:i:s O'; | ||
$actual = $formatter->getDateFormat(); | ||
$I->assertEquals($expected, $actual); | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <team@phalconphp.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Phalcon\Test\Unit\Logger\Formatter\Json; | ||
|
||
use Phalcon\Logger\Formatter\Json; | ||
use UnitTester; | ||
|
||
/** | ||
* Class SetDateFormatCest | ||
* | ||
* @package Phalcon\Test\Unit\Logger | ||
*/ | ||
class SetDateFormatCest | ||
{ | ||
/** | ||
* Tests Phalcon\Logger\Formatter\Json :: setDateFormat() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <team@phalconphp.com> | ||
* @since 2018-11-13 | ||
*/ | ||
public function loggerFormatterJsonSetDateFormat(UnitTester $I) | ||
{ | ||
$I->wantToTest("Logger\Formatter\Json - setDateFormat()"); | ||
$formatter = new Json(); | ||
|
||
$format = 'YmdHis'; | ||
$formatter->setDateFormat($format); | ||
|
||
$expected = $format; | ||
$actual = $formatter->getDateFormat(); | ||
$I->assertEquals($expected, $actual); | ||
} | ||
} |
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