-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vitex
committed
May 21, 2021
1 parent
ff0de6c
commit a4d00ac
Showing
4 changed files
with
30 additions
and
33 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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/** | ||
* @author Vítězslav Dvořák <[email protected]> | ||
* @copyright (c) 2018-2020, Vítězslav Dvořák | ||
|
@@ -11,8 +12,8 @@ | |
/** | ||
* Generated by PHPUnit_SkeletonGenerator on 2018-04-20 at 20:42:56. | ||
*/ | ||
class HookRecieverTest extends \Test\AbraFlexi\ChangesTest | ||
{ | ||
class HookRecieverTest extends \Test\AbraFlexi\ChangesTest { | ||
|
||
/** | ||
* @var HookReciever | ||
*/ | ||
|
@@ -23,34 +24,30 @@ class HookRecieverTest extends \Test\AbraFlexi\ChangesTest | |
* | ||
* @return int | ||
*/ | ||
public static function getFakeChangeId() | ||
{ | ||
public static function getFakeChangeId() { | ||
return time() - 1524247660; | ||
} | ||
|
||
/** | ||
* Sets up the fixture, for example, opens a network connection | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp() : void | ||
{ | ||
$this->object = new HookReciever(null, ['debug' => true]); | ||
protected function setUp(): void { | ||
$this->object = new HookReciever(null, ['debug' => true, 'throwException' => false]); | ||
} | ||
|
||
/** | ||
* Tears down the fixture, for example, closes a network connection. | ||
* This method is called after a test is executed. | ||
*/ | ||
protected function tearDown() : void | ||
{ | ||
protected function tearDown(): void { | ||
|
||
} | ||
|
||
/** | ||
* @covers \AbraFlexi\Bricks\HookReciever::listen | ||
*/ | ||
public function testListen() | ||
{ | ||
public function testListen() { | ||
$this->object->listen(); | ||
$this->object->listen('tests/config.json'); | ||
$this->object->listen('tests/phpunit.xml'); | ||
|
@@ -59,22 +56,20 @@ public function testListen() | |
/** | ||
* @covers \AbraFlexi\Bricks\HookReciever::takeChanges | ||
*/ | ||
public function testTakeChanges() | ||
{ | ||
public function testTakeChanges() { | ||
$this->object->takeChanges(null); | ||
$this->assertEquals(254924, | ||
$this->object->takeChanges($this->object->listen('tests/changes.json'))); | ||
$this->object->takeChanges($this->object->listen('tests/changes.json'))); | ||
} | ||
|
||
/** | ||
* @covers \AbraFlexi\Bricks\HookReciever::processChanges | ||
* @depends testTakeChanges | ||
*/ | ||
public function testProcessChanges() | ||
{ | ||
public function testProcessChanges() { | ||
$this->object->processChanges(); | ||
$globalVersion = self::getFakeChangeId(); | ||
$changes = $this->object->listen('tests/changes.json'); | ||
$changes = $this->object->listen('tests/changes.json'); | ||
foreach ($changes['winstrom']['changes'] as $chPos => $change) { | ||
$changes['winstrom']['changes'][$chPos]['@in-version'] = $globalVersion++; | ||
} | ||
|
@@ -87,11 +82,11 @@ public function testProcessChanges() | |
* @covers \AbraFlexi\Bricks\HookReciever::saveLastProcessedVersion | ||
* @covers \AbraFlexi\Bricks\HookReciever::getLastProcessedVersion | ||
*/ | ||
public function testSaveLastProcessedVersion() | ||
{ | ||
public function testSaveLastProcessedVersion() { | ||
$this->object->saveLastProcessedVersion('X'); | ||
$fchid = self::getFakeChangeId(); | ||
$this->object->saveLastProcessedVersion($fchid); | ||
$this->assertEquals($fchid, $this->object->getLastProcessedVersion()); | ||
} | ||
|
||
} |