mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-12 02:11:45 +01:00
Tests - implement BaseTestCase::assert*() methods to verify constructors
This commit is contained in:
@@ -10,7 +10,6 @@ namespace Meritoo\LimeSurvey\Test\ApiClient\Base\Result;
|
||||
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseItem;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Test case of the base class for one item of result/data fetched while talking to the LimeSurvey's API
|
||||
@@ -22,10 +21,7 @@ class BaseItemTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
$reflection = new ReflectionClass(BaseItem::class);
|
||||
$constructor = $reflection->getConstructor();
|
||||
|
||||
static::assertNull($constructor);
|
||||
static::assertHasNoConstructor(BaseItem::class);
|
||||
}
|
||||
|
||||
public function testSetValues()
|
||||
|
||||
@@ -34,6 +34,11 @@ class ClientTest extends BaseTestCase
|
||||
*/
|
||||
private $configuration;
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(Client::class, OopVisibilityType::IS_PUBLIC, 3, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $incorrectMethod Incorrect name of method to call
|
||||
* @dataProvider provideIncorrectMethod
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Meritoo\LimeSurvey\Test\ApiClient\Configuration;
|
||||
use Generator;
|
||||
use Meritoo\Common\Exception\Regex\InvalidUrlException;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Type\OopVisibilityType;
|
||||
use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
|
||||
|
||||
/**
|
||||
@@ -21,6 +22,11 @@ use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
|
||||
*/
|
||||
class ConnectionConfigurationTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(ConnectionConfiguration::class, OopVisibilityType::IS_PUBLIC, 4, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $emptyBaseUrl Empty base url
|
||||
* @dataProvider provideEmptyBaseUrl
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
||||
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Item\ParticipantShort;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* Test case of the one item of the result/data: short data of participant
|
||||
@@ -19,7 +19,7 @@ use PHPUnit_Framework_TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class ParticipantShortTest extends PHPUnit_Framework_TestCase
|
||||
class ParticipantShortTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Raw data of participants
|
||||
@@ -42,6 +42,11 @@ class ParticipantShortTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
private $participant2ndInstance;
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(ParticipantShort::class);
|
||||
}
|
||||
|
||||
public function testCreateOfTheParticipant()
|
||||
{
|
||||
$processor = new ResultProcessor();
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
||||
|
||||
use DateTime;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Item\Participant;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* Test case of the one item of the result/data: full data of participant
|
||||
@@ -20,7 +20,7 @@ use PHPUnit_Framework_TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class ParticipantTest extends PHPUnit_Framework_TestCase
|
||||
class ParticipantTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Raw data of participants
|
||||
@@ -43,6 +43,11 @@ class ParticipantTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
private $participant2ndInstance;
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(Participant::class);
|
||||
}
|
||||
|
||||
public function testCreateOfTheParticipant()
|
||||
{
|
||||
$processor = new ResultProcessor();
|
||||
|
||||
@@ -42,6 +42,11 @@ class QuestionShortTest extends BaseTestCase
|
||||
*/
|
||||
private $question2ndInstance;
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(QuestionShort::class);
|
||||
}
|
||||
|
||||
public function testCreateOfTheQuestionShort()
|
||||
{
|
||||
$processor = new ResultProcessor();
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
||||
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Item\Question;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* Test case of the one item of the result/data: full data of one question of survey
|
||||
@@ -19,7 +19,7 @@ use PHPUnit_Framework_TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class QuestionTest extends PHPUnit_Framework_TestCase
|
||||
class QuestionTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Raw data of questions
|
||||
@@ -42,6 +42,11 @@ class QuestionTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
private $question2ndInstance;
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(Question::class);
|
||||
}
|
||||
|
||||
public function testCreateOfTheQuestionShort()
|
||||
{
|
||||
$processor = new ResultProcessor();
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
||||
|
||||
use DateTime;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Item\Survey;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* Test case of the one item of the result/data: survey
|
||||
@@ -20,7 +20,7 @@ use PHPUnit_Framework_TestCase;
|
||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
* @copyright Meritoo.pl
|
||||
*/
|
||||
class SurveyTest extends PHPUnit_Framework_TestCase
|
||||
class SurveyTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Raw data of surveys
|
||||
@@ -43,6 +43,11 @@ class SurveyTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
private $survey2ndInstance;
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(Survey::class);
|
||||
}
|
||||
|
||||
public function testCreateOfTheSurvey()
|
||||
{
|
||||
$processor = new ResultProcessor();
|
||||
|
||||
@@ -15,7 +15,6 @@ use Meritoo\LimeSurvey\ApiClient\Exception\UnknownInstanceOfResultItem;
|
||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||
use Meritoo\LimeSurvey\Test\ApiClient\Result\Item\SurveyTest;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Test case of the processor of the raw data fetched while talking to the LimeSurvey's API
|
||||
@@ -27,10 +26,7 @@ class ResultProcessorTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
$reflection = new ReflectionClass(ResultProcessor::class);
|
||||
$constructor = $reflection->getConstructor();
|
||||
|
||||
static::assertNull($constructor);
|
||||
static::assertHasNoConstructor(ResultProcessor::class);
|
||||
}
|
||||
|
||||
public function testProcessWithEmptyRawData()
|
||||
|
||||
@@ -21,6 +21,11 @@ use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||
*/
|
||||
class MethodTypeTest extends BaseTypeTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(MethodType::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $incorrectMethod Type of method to verify
|
||||
* @dataProvider provideIncorrectMethod
|
||||
|
||||
@@ -19,6 +19,11 @@ use Meritoo\LimeSurvey\ApiClient\Type\SystemMethodType;
|
||||
*/
|
||||
class SystemMethodTypeTest extends BaseTypeTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertHasNoConstructor(SystemMethodType::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user