Skip to content

Commit

Permalink
Update coding style (fixes #40)
Browse files Browse the repository at this point in the history
  • Loading branch information
foglcz committed Nov 27, 2017
1 parent 3404519 commit 714b656
Showing 1 changed file with 51 additions and 33 deletions.
84 changes: 51 additions & 33 deletions tests/IntegrationTests/ItemPropertiesSetupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@
*/
class ItemPropertiesSetupTest extends IntegrationTestCase
{
/** @test This throws an error in Matej's MGW, but API will return OK */
public function issueEventWithUnsetProperties(): void
/**
* In Matej's component MGW, this will throw an error, because the property isn't defined.
* The API will however return OK. This is desired behaviour.
*
* @test
*/
public function shouldIssueEventWithUnknownPropertyButPassOk(): void
{
$response = $this->createMatejInstance()->request()
$response = $this->createMatejInstance()
->request()
->events()
->addItemProperty(
Command\ItemProperty::create(
'unittest-phpsdk-item-id',
['unittest_phpsdk_property_1' => true, 'unittest_phpsdk_property_2' => false]
'integration-test-php-clientitem-id',
['integration_test_php_client_property_1' => true, 'integration_test_php_client_property_2' => false]
)
)
->send();
Expand All @@ -34,18 +40,22 @@ public function issueEventWithUnsetProperties(): void
$this->assertSame('', $commandResponse->getMessage());
}

/** @test @depends issueEventWithUnsetProperties */
public function createItemProperties(): void
/**
* @test
* @depends shouldIssueEventWithUnknownPropertyButPassOk
*/
public function shouldCreateNewPropertiesInMatej(): void
{
$response = $this->createMatejInstance()->request()
$response = $this->createMatejInstance()
->request()
->setupItemProperties()
->addProperty(Command\ItemPropertySetup::boolean('unittest_phpsdk_bool'))
->addProperty(Command\ItemPropertySetup::double('unittest_phpsdk_double'))
->addProperty(Command\ItemPropertySetup::int('unittest_phpsdk_int'))
->addProperty(Command\ItemPropertySetup::string('unittest_phpsdk_string'))
->addProperty(Command\ItemPropertySetup::boolean('integration_test_php_client_bool'))
->addProperty(Command\ItemPropertySetup::double('integration_test_php_client_double'))
->addProperty(Command\ItemPropertySetup::int('integration_test_php_client_int'))
->addProperty(Command\ItemPropertySetup::string('integration_test_php_client_string'))
->addProperties([
Command\ItemPropertySetup::timestamp('unittest_phpsdk_timestamp'),
Command\ItemPropertySetup::set('unittest_phpsdk_set'),
Command\ItemPropertySetup::timestamp('integration_test_php_client_timestamp'),
Command\ItemPropertySetup::set('integration_test_php_client_set'),
])
->send();

Expand All @@ -55,21 +65,25 @@ public function createItemProperties(): void
$this->assertSame(0, $response->getNumberOfSkippedCommands());
}

/** @test @depends createItemProperties */
public function issueEventWithProperties(): void
/**
* @test
* @depends shouldCreateNewPropertiesInMatej
*/
public function shouldIssueEventWithJustCreatedProperties(): void
{
$response = $this->createMatejInstance()->request()
$response = $this->createMatejInstance()
->request()
->events()
->addItemProperty(
Command\ItemProperty::create(
'unittest-phpsdk-item-id',
'integration-test-php-clientitem-id',
[
'unittest_phpsdk_bool' => true,
'unittest_phpsdk_double' => 0.15,
'unittest_phpsdk_int' => 15,
'unittest_phpsdk_string' => 'some_string',
'unittest_phpsdk_timestamp' => 123456789,
'unittest_phpsdk_set' => ['some', 'set'],
'integration_test_php_client_bool' => true,
'integration_test_php_client_double' => 0.15,
'integration_test_php_client_int' => 15,
'integration_test_php_client_string' => 'some_string',
'integration_test_php_client_timestamp' => 123456789,
'integration_test_php_client_set' => ['some', 'set'],
]
)
)
Expand All @@ -81,18 +95,22 @@ public function issueEventWithProperties(): void
$this->assertSame(0, $response->getNumberOfSkippedCommands());
}

/** @test @depends issueEventWithProperties */
public function deleteItemProperties(): void
/**
* @test
* @depends shouldIssueEventWithJustCreatedProperties
*/
public function shouldDeleteCreatedPropertiesFromMatej(): void
{
$response = $this->createMatejInstance()->request()
$response = $this->createMatejInstance()
->request()
->deleteItemProperties()
->addProperty(Command\ItemPropertySetup::boolean('unittest_phpsdk_bool'))
->addProperty(Command\ItemPropertySetup::double('unittest_phpsdk_double'))
->addProperty(Command\ItemPropertySetup::int('unittest_phpsdk_int'))
->addProperty(Command\ItemPropertySetup::string('unittest_phpsdk_string'))
->addProperty(Command\ItemPropertySetup::boolean('integration_test_php_client_bool'))
->addProperty(Command\ItemPropertySetup::double('integration_test_php_client_double'))
->addProperty(Command\ItemPropertySetup::int('integration_test_php_client_int'))
->addProperty(Command\ItemPropertySetup::string('integration_test_php_client_string'))
->addProperties([
Command\ItemPropertySetup::timestamp('unittest_phpsdk_timestamp'),
Command\ItemPropertySetup::set('unittest_phpsdk_set'),
Command\ItemPropertySetup::timestamp('integration_test_php_client_timestamp'),
Command\ItemPropertySetup::set('integration_test_php_client_set'),
])
->send();

Expand Down

0 comments on commit 714b656

Please sign in to comment.