Commit 3c479396 authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller
Browse files

Testing

parent ceea61d2
Pipeline #17692 failed
.docker
.idea
.php_cs.cache
vendor
composer.lock
\ No newline at end of file
stages:
- test
variables:
COMPOSER_ALLOW_SUPERUSER: "1"
COMPOSER_DISABLE_XDEBUG_WARN: "1"
.php_template: &php_definition
variables:
MYSQL_PASSWORD: dev
MYSQL_USER: dev
MYSQL_DATABASE: project
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_HOST: mysql
MYSQL_PASS: dev
MYSQL_DB: powerdns
services:
- mysql
- dockerhub.cwd.at/docker/powerdns:master
before_script:
- export COMPOSER_CACHE_DIR="$(pwd -P)/.composer-cache"
- export APP_ENV=test
- apk add --no-cache mysql-client
- echo "CREATE DATABASE IF NOT EXISTS powerdns;GRANT ALL ON powerdns.* TO 'dev'@'%' IDENTIFIED BY 'dev';" | mysql -h mysql -u root
#- mkdir -p build/api build/coverage build/logs
- composer install --prefer-dist --ansi --no-progress --no-suggest
script:
#- vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs
# - php -d zend.enable_gc=0 bin/phpunit -c ./phpunit.xml.dist --coverage-html=build/coverage --coverage-xml=build/logs/coverage --log-junit=build/logs/phpunit.xml --coverage-text --colors=never
#- bin/behat --format=progress --verbose --stop-on-failure
stage: test
cache:
key: "${CI_PROJECT_PATH_SLUG}-cache"
paths:
- .composer-cache
policy: pull-push
test:php7.1:
<<: *php_definition
image: dockerhub.cwd.at/docker/php/cli-xdebug:7.1
# artifacts:
# name: coverage
# paths:
# - build/coverage
# - build/logs
# when: on_success
# expire_in: 2 days
tags:
- autoscale
test:php7.2:
<<: *php_definition
image: dockerhub.cwd.at/docker/php/cli-xdebug:7.2
cache:
policy: pull
tags:
- autoscale
test:php7.3:
<<: *php_definition
image: dockerhub.cwd.at/docker/php/cli-xdebug:7.3
cache:
policy: pull
tags:
- autoscale
\ No newline at end of file
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2017 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->notName('*.twig')
->in([__DIR__])
;
$year = date('Y');
return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'declare_strict_types' => true,
'header_comment' => [
'header' => <<<EOF
This file is part of the CwdPowerDNS Client
(c) {$year} cwd.at GmbH <office@cwd.at>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF
,
'location' => 'after_open',
],
])
->setFinder($finder)
;
<?php
/*
* This file is part of powerdns client.
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
......@@ -66,9 +66,6 @@ class Client
$uri = sprintf('%s/%s', $this->apiUri, $uri);
$uri = rtrim($uri, '/');
dump($uri);
$request = new Request($method, $uri, [
'X-API-Key' => $this->apiKey,
'Content-Type' => 'application/json',
......@@ -78,8 +75,6 @@ class Client
$responseBody = $response->getBody()->getContents();
$responseData = json_decode($responseBody);
dump($responseData);
if ($response->getStatusCode() >= 300) {
$message = isset($responseData->message) ?? 'Unknown';
throw new \Exception(sprintf('Error on request %s: %s', $response->getStatusCode(), $message));
......@@ -94,7 +89,6 @@ class Client
return $responseData;
}
public function denormalizeObject($hydrationClass, $dataObject, $isList = false)
{
if (!$isList) {
......
<?php
/*
* This file is part of datamolino client.
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
......
<?php
/*
* This file is part of datamolino client.
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
......@@ -13,7 +13,6 @@ declare(strict_types=1);
namespace Cwd\PowerDNSClient\Endpoints;
use Cwd\PowerDNSClient\Model\Server;
class ServersEndpoint extends AbstractEndpoint
......@@ -22,7 +21,7 @@ class ServersEndpoint extends AbstractEndpoint
public function get(?string $serverId = null): Server
{
if ($serverId === null) {
if (null === $serverId) {
$serverId = $this->defaultServerId;
}
......@@ -31,6 +30,7 @@ class ServersEndpoint extends AbstractEndpoint
/**
* @return Servers[]
*
* @throws \Http\Client\Exception
*/
public function all(): array
......@@ -46,6 +46,6 @@ class ServersEndpoint extends AbstractEndpoint
public function statistics(): array
{
// Result is different - denormalize by hand
return $this->getClient()->call(null, sprintf( self::ENDPOINT, $this->defaultServerId).'/statistics', null, false, 'GET');
return $this->getClient()->call(null, sprintf(self::ENDPOINT, $this->defaultServerId).'/statistics', null, false, 'GET');
}
}
Copyright 2018 cwd.at GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Model;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Model;
class CacheFlushResult
{
/** @var integer */
/** @var int */
private $count;
/** @var string */
private $result;
......@@ -21,11 +30,13 @@ class CacheFlushResult
/**
* @param int $count
*
* @return CacheFlushResult
*/
public function setCount(int $count): CacheFlushResult
{
$this->count = $count;
return $this;
}
......@@ -39,11 +50,13 @@ class CacheFlushResult
/**
* @param string $result
*
* @return CacheFlushResult
*/
public function setResult(string $result): CacheFlushResult
{
$this->result = $result;
return $this;
}
}
\ No newline at end of file
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Model;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Model;
class Cryptokey
{
......@@ -12,7 +21,7 @@ class Cryptokey
private $id;
/** @var string */
private $keytype;
/** @var bool */
/** @var bool */
private $active = false;
/** @var string */
private $dnskey;
......@@ -22,7 +31,7 @@ class Cryptokey
private $privatekey;
/** @var string */
private $algorithm;
/** @var integer */
/** @var int */
private $bits;
/**
......@@ -35,11 +44,13 @@ class Cryptokey
/**
* @param string $type
*
* @return Cryptokey
*/
public function setType(string $type): Cryptokey
{
$this->type = $type;
return $this;
}
......@@ -53,11 +64,13 @@ class Cryptokey
/**
* @param string $id
*
* @return Cryptokey
*/
public function setId(string $id): Cryptokey
{
$this->id = $id;
return $this;
}
......@@ -71,11 +84,13 @@ class Cryptokey
/**
* @param string $keytype
*
* @return Cryptokey
*/
public function setKeytype(string $keytype): Cryptokey
{
$this->keytype = $keytype;
return $this;
}
......@@ -89,11 +104,13 @@ class Cryptokey
/**
* @param bool $active
*
* @return Cryptokey
*/
public function setActive(bool $active): Cryptokey
{
$this->active = $active;
return $this;
}
......@@ -107,11 +124,13 @@ class Cryptokey
/**
* @param string $dnskey
*
* @return Cryptokey
*/
public function setDnskey(string $dnskey): Cryptokey
{
$this->dnskey = $dnskey;
return $this;
}
......@@ -125,11 +144,13 @@ class Cryptokey
/**
* @param string[] $ds
*
* @return Cryptokey
*/
public function setDs(array $ds): Cryptokey
{
$this->ds = $ds;
return $this;
}
......@@ -143,11 +164,13 @@ class Cryptokey
/**
* @param string $privatekey
*
* @return Cryptokey
*/
public function setPrivatekey(string $privatekey): Cryptokey
{
$this->privatekey = $privatekey;
return $this;
}
......@@ -161,11 +184,13 @@ class Cryptokey
/**
* @param string $algorithm
*
* @return Cryptokey
*/
public function setAlgorithm(string $algorithm): Cryptokey
{
$this->algorithm = $algorithm;
return $this;
}
......@@ -179,11 +204,13 @@ class Cryptokey
/**
* @param int $bits
*
* @return Cryptokey
*/
public function setBits(int $bits): Cryptokey
{
$this->bits = $bits;
return $this;
}
}
\ No newline at end of file
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Model;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Model;
class Metadata
{
......@@ -21,11 +30,13 @@ class Metadata
/**
* @param string $kind
*
* @return Metadata
*/
public function setKind(string $kind): Metadata
{
$this->kind = $kind;
return $this;
}
......@@ -39,11 +50,13 @@ class Metadata
/**
* @param string[] $metadata
*
* @return Metadata
*/
public function setMetadata(array $metadata): Metadata
{
$this->metadata = $metadata;
return $this;
}
}
\ No newline at end of file
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Model;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Model;
class SearchResult
{
/** @var string */
private $content;
/** @var bool */
/** @var bool */
private $disabled = false;
/** @var string */
private $name;
......@@ -20,7 +29,7 @@ class SearchResult
private $zone;
/** @var string */
private $type;
/** @var integer */
/** @var int */
private $ttl;
/**
......@@ -33,11 +42,13 @@ class SearchResult
/**
* @param string $content
*
* @return SearchResult
*/
public function setContent(string $content): SearchResult
{
$this->content = $content;
return $this;
}
......@@ -51,11 +62,13 @@ class SearchResult
/**
* @param bool $disabled
*
* @return SearchResult
*/
public function setDisabled(bool $disabled): SearchResult
{
$this->disabled = $disabled;
return $this;
}
......@@ -69,11 +82,13 @@ class SearchResult
/**
* @param string $name
*
* @return SearchResult
*/
public function setName(string $name): SearchResult
{
$this->name = $name;
return $this;
}
......@@ -87,11 +102,13 @@ class SearchResult
/**
* @param string $objectType
*
* @return SearchResult
*/
public function setObjectType(string $objectType): SearchResult
{
$this->objectType = $objectType;
return $this;
}
......@@ -105,11 +122,13 @@ class SearchResult
/**
* @param string $zoneId
*
* @return SearchResult
*/
public function setZoneId(string $zoneId): SearchResult
{
$this->zoneId = $zoneId;
return $this;
}
......@@ -123,11 +142,13 @@ class SearchResult
/**
* @param string $zone
*
* @return SearchResult
*/
public function setZone(string $zone): SearchResult
{
$this->zone = $zone;
return $this;
}
......@@ -141,11 +162,13 @@ class SearchResult
/**
* @param string $type
*
* @return SearchResult
*/
public function setType(string $type): SearchResult
{
$this->type = $type;
return $this;
}
......@@ -159,11 +182,13 @@ class SearchResult
/**
* @param int $ttl
*
* @return SearchResult
*/
public function setTtl(int $ttl): SearchResult
{
$this->ttl = $ttl;
return $this;
}
}
\ No newline at end of file
}
<?php
/*
* This file is part of the CwdPowerDNS Client
*
* (c) 2018 cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cwd\PowerDNSClient\Model;
declare(strict_types=1);
namespace Cwd\PowerDNSClient\Model;
class Server
{
......@@ -31,11 +40,13 @@ class Server
/**
* @param string $type
*
* @return Server
*/
public function setType(string $type): Server
{
$this->type = $type;
return $this;
}
......@@ -49,11 +60,13 @@ class Server
/**
* @param string $id
*
* @return Server
*/
public function setId(string $id): Server
{