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:
@@ -92,7 +92,7 @@ class Client
|
|||||||
->getSessionKey($username, $password);
|
->getSessionKey($username, $password);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the session's key as of the method's arguments
|
* Use the session's key as one of the method's arguments
|
||||||
*/
|
*/
|
||||||
array_unshift($arguments, $sessionKey);
|
array_unshift($arguments, $sessionKey);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ namespace Meritoo\LimeSurvey\Test\ApiClient\Base\Result;
|
|||||||
|
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseItem;
|
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
|
* 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()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
$reflection = new ReflectionClass(BaseItem::class);
|
static::assertHasNoConstructor(BaseItem::class);
|
||||||
$constructor = $reflection->getConstructor();
|
|
||||||
|
|
||||||
static::assertNull($constructor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetValues()
|
public function testSetValues()
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ class ClientTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
private $configuration;
|
private $configuration;
|
||||||
|
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertConstructorVisibilityAndArguments(Client::class, OopVisibilityType::IS_PUBLIC, 3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $incorrectMethod Incorrect name of method to call
|
* @param string $incorrectMethod Incorrect name of method to call
|
||||||
* @dataProvider provideIncorrectMethod
|
* @dataProvider provideIncorrectMethod
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace Meritoo\LimeSurvey\Test\ApiClient\Configuration;
|
|||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Regex\InvalidUrlException;
|
use Meritoo\Common\Exception\Regex\InvalidUrlException;
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
|
use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,6 +22,11 @@ use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration;
|
|||||||
*/
|
*/
|
||||||
class ConnectionConfigurationTest extends BaseTestCase
|
class ConnectionConfigurationTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertConstructorVisibilityAndArguments(ConnectionConfiguration::class, OopVisibilityType::IS_PUBLIC, 4, 3);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $emptyBaseUrl Empty base url
|
* @param mixed $emptyBaseUrl Empty base url
|
||||||
* @dataProvider provideEmptyBaseUrl
|
* @dataProvider provideEmptyBaseUrl
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
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\Item\ParticipantShort;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||||
use PHPUnit_Framework_TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case of the one item of the result/data: short data of participant
|
* 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>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class ParticipantShortTest extends PHPUnit_Framework_TestCase
|
class ParticipantShortTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Raw data of participants
|
* Raw data of participants
|
||||||
@@ -42,6 +42,11 @@ class ParticipantShortTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
private $participant2ndInstance;
|
private $participant2ndInstance;
|
||||||
|
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(ParticipantShort::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreateOfTheParticipant()
|
public function testCreateOfTheParticipant()
|
||||||
{
|
{
|
||||||
$processor = new ResultProcessor();
|
$processor = new ResultProcessor();
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Result\Item\Participant;
|
use Meritoo\LimeSurvey\ApiClient\Result\Item\Participant;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||||
use PHPUnit_Framework_TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case of the one item of the result/data: full data of participant
|
* 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>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class ParticipantTest extends PHPUnit_Framework_TestCase
|
class ParticipantTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Raw data of participants
|
* Raw data of participants
|
||||||
@@ -43,6 +43,11 @@ class ParticipantTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
private $participant2ndInstance;
|
private $participant2ndInstance;
|
||||||
|
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(Participant::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreateOfTheParticipant()
|
public function testCreateOfTheParticipant()
|
||||||
{
|
{
|
||||||
$processor = new ResultProcessor();
|
$processor = new ResultProcessor();
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ class QuestionShortTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
private $question2ndInstance;
|
private $question2ndInstance;
|
||||||
|
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(QuestionShort::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreateOfTheQuestionShort()
|
public function testCreateOfTheQuestionShort()
|
||||||
{
|
{
|
||||||
$processor = new ResultProcessor();
|
$processor = new ResultProcessor();
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
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\Item\Question;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
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
|
* 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>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class QuestionTest extends PHPUnit_Framework_TestCase
|
class QuestionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Raw data of questions
|
* Raw data of questions
|
||||||
@@ -42,6 +42,11 @@ class QuestionTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
private $question2ndInstance;
|
private $question2ndInstance;
|
||||||
|
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(Question::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreateOfTheQuestionShort()
|
public function testCreateOfTheQuestionShort()
|
||||||
{
|
{
|
||||||
$processor = new ResultProcessor();
|
$processor = new ResultProcessor();
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
namespace Meritoo\LimeSurvey\Test\ApiClient\Result\Item;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Result\Item\Survey;
|
use Meritoo\LimeSurvey\ApiClient\Result\Item\Survey;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||||
use PHPUnit_Framework_TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case of the one item of the result/data: survey
|
* 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>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class SurveyTest extends PHPUnit_Framework_TestCase
|
class SurveyTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Raw data of surveys
|
* Raw data of surveys
|
||||||
@@ -43,6 +43,11 @@ class SurveyTest extends PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
private $survey2ndInstance;
|
private $survey2ndInstance;
|
||||||
|
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(Survey::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreateOfTheSurvey()
|
public function testCreateOfTheSurvey()
|
||||||
{
|
{
|
||||||
$processor = new ResultProcessor();
|
$processor = new ResultProcessor();
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use Meritoo\LimeSurvey\ApiClient\Exception\UnknownInstanceOfResultItem;
|
|||||||
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
use Meritoo\LimeSurvey\ApiClient\Result\Processor\ResultProcessor;
|
||||||
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
||||||
use Meritoo\LimeSurvey\Test\ApiClient\Result\Item\SurveyTest;
|
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
|
* 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()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
$reflection = new ReflectionClass(ResultProcessor::class);
|
static::assertHasNoConstructor(ResultProcessor::class);
|
||||||
$constructor = $reflection->getConstructor();
|
|
||||||
|
|
||||||
static::assertNull($constructor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProcessWithEmptyRawData()
|
public function testProcessWithEmptyRawData()
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ use Meritoo\LimeSurvey\ApiClient\Type\MethodType;
|
|||||||
*/
|
*/
|
||||||
class MethodTypeTest extends BaseTypeTestCase
|
class MethodTypeTest extends BaseTypeTestCase
|
||||||
{
|
{
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(MethodType::class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $incorrectMethod Type of method to verify
|
* @param string $incorrectMethod Type of method to verify
|
||||||
* @dataProvider provideIncorrectMethod
|
* @dataProvider provideIncorrectMethod
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ use Meritoo\LimeSurvey\ApiClient\Type\SystemMethodType;
|
|||||||
*/
|
*/
|
||||||
class SystemMethodTypeTest extends BaseTypeTestCase
|
class SystemMethodTypeTest extends BaseTypeTestCase
|
||||||
{
|
{
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
static::assertHasNoConstructor(SystemMethodType::class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user