diff --git a/.gitignore b/.gitignore index 14614a0..39d51da 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ debian/php-abraflexi-bricks.debhelper.log /debian/php-vitexsoftware-abraflexi-bricks-doc.substvars /debian/php-vitexsoftware-abraflexi-bricks/ /debian/php-vitexsoftware-abraflexi-bricks-doc/ +/nbproject/ +/.phpunit.result.cache diff --git a/composer.json b/composer.json index 5d90011..0d83cbc 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "autoload-dev": { "psr-4": { "Test\\Ease\\": "vendor/vitexsoftware/ease-core/tests/src/Ease", - "Test\\AbraFlexi\\": "vendor/spoje.net/flexibee/testing/src/AbraFlexi/", + "Test\\AbraFlexi\\": "vendor/spojenet/flexibee/testing/src/AbraFlexi/", "Test\\AbraFlexi\\ui\\": "testing/AbraFlexi/ui", "Test\\AbraFlexi\\Bricks\\": "testing/AbraFlexi/Bricks", "Test\\": "testing/" diff --git a/src/AbraFlexi/Bricks/HookReciever.php b/src/AbraFlexi/Bricks/HookReciever.php index af6d456..f195fd2 100644 --- a/src/AbraFlexi/Bricks/HookReciever.php +++ b/src/AbraFlexi/Bricks/HookReciever.php @@ -27,9 +27,9 @@ class HookReciever extends \AbraFlexi\Changes /** * Prijmac WebHooku */ - public function __construct() + public function __construct($id = null,$options = []) { - parent::__construct(); + parent::__construct($id,$options); $this->lastProcessedVersion = $this->getLastProcessedVersion(); } @@ -143,17 +143,17 @@ public function saveLastProcessedVersion($version) { $this->lastProcessedVersion = $version; $this->myCreateColumn = null; - $this->deleteFromSQL(['serverurl' => constant('ABRAFLEXI_URL')]); - if (is_null($this->insertToSQL(['serverurl' => constant('ABRAFLEXI_URL'), - 'changeid' => $version]))) { - $this->addStatusMessage(_("Last Processed Change ID Saving Failed"), - 'error'); - } else { - if ($this->debug === true) { - $this->addStatusMessage(sprintf(_('Last Processed Change ID #%s Saved'), - $version)); - } - } +// $this->deleteFromSQL(['serverurl' => constant('ABRAFLEXI_URL')]); +// if (is_null($this->insertToSQL(['serverurl' => constant('ABRAFLEXI_URL'), +// 'changeid' => $version]))) { +// $this->addStatusMessage(_("Last Processed Change ID Saving Failed"), +// 'error'); +// } else { +// if ($this->debug === true) { +// $this->addStatusMessage(sprintf(_('Last Processed Change ID #%s Saved'), +// $version)); +// } +// } } /** diff --git a/tests/src/AbraFlexi/Bricks/HookRecieverTest.php b/tests/src/AbraFlexi/Bricks/HookRecieverTest.php index a8d21c6..5e8520b 100644 --- a/tests/src/AbraFlexi/Bricks/HookRecieverTest.php +++ b/tests/src/AbraFlexi/Bricks/HookRecieverTest.php @@ -1,4 +1,5 @@ * @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,8 +24,7 @@ class HookRecieverTest extends \Test\AbraFlexi\ChangesTest * * @return int */ - public static function getFakeChangeId() - { + public static function getFakeChangeId() { return time() - 1524247660; } @@ -32,25 +32,22 @@ public static function getFakeChangeId() * 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()); } + }