Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend all testing #4

Merged
merged 6 commits into from
May 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"eloquent/liberator": "^2.0",
"league/oauth2-client": "^2.2",
"mediact/dependency-guard": "^1.0",
"mockery/mockery": "dev-master",
"phpstan/phpstan": "^0.10.1",
"phpunit/phpunit": "^7.3",
"mockery/mockery": "dev-master"
"phpunit/phpunit": "^7.3"
}
}
88 changes: 44 additions & 44 deletions readme.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use PhpTwinfield\Fields\BehaviourField;
use PhpTwinfield\Fields\CodeField;
use PhpTwinfield\Fields\Dimensions\DimensionType\TypeField;
use PhpTwinfield\Fields\InUseField;
use PhpTwinfield\Fields\Level1234\DimensionType\TypeField;
use PhpTwinfield\Fields\NameField;
use PhpTwinfield\Fields\OfficeField;
use PhpTwinfield\Fields\ShortNameField;
Expand Down
28 changes: 14 additions & 14 deletions src/ActivityProjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
namespace PhpTwinfield;

use PhpTwinfield\Fields\CustomerField;
use PhpTwinfield\Fields\Level1234\Level34\AuthoriserField;
use PhpTwinfield\Fields\Level1234\Level34\AuthoriserInheritField;
use PhpTwinfield\Fields\Level1234\Level34\AuthoriserLockedField;
use PhpTwinfield\Fields\Level1234\Level34\BillableField;
use PhpTwinfield\Fields\Level1234\Level34\BillableForRatioField;
use PhpTwinfield\Fields\Level1234\Level34\BillableInheritField;
use PhpTwinfield\Fields\Level1234\Level34\BillableLockedField;
use PhpTwinfield\Fields\Level1234\Level34\CustomerInheritField;
use PhpTwinfield\Fields\Level1234\Level34\CustomerLockedField;
use PhpTwinfield\Fields\Level1234\Level34\InvoiceDescriptionField;
use PhpTwinfield\Fields\Level1234\Level34\RateInheritField;
use PhpTwinfield\Fields\Level1234\Level34\RateLockedField;
use PhpTwinfield\Fields\Level1234\Level34\ValidFromField;
use PhpTwinfield\Fields\Level1234\Level34\ValidTillField;
use PhpTwinfield\Fields\Dimensions\Level34\AuthoriserField;
use PhpTwinfield\Fields\Dimensions\Level34\AuthoriserInheritField;
use PhpTwinfield\Fields\Dimensions\Level34\AuthoriserLockedField;
use PhpTwinfield\Fields\Dimensions\Level34\BillableField;
use PhpTwinfield\Fields\Dimensions\Level34\BillableForRatioField;
use PhpTwinfield\Fields\Dimensions\Level34\BillableInheritField;
use PhpTwinfield\Fields\Dimensions\Level34\BillableLockedField;
use PhpTwinfield\Fields\Dimensions\Level34\CustomerInheritField;
use PhpTwinfield\Fields\Dimensions\Level34\CustomerLockedField;
use PhpTwinfield\Fields\Dimensions\Level34\InvoiceDescriptionField;
use PhpTwinfield\Fields\Dimensions\Level34\RateInheritField;
use PhpTwinfield\Fields\Dimensions\Level34\RateLockedField;
use PhpTwinfield\Fields\Dimensions\Level34\ValidFromField;
use PhpTwinfield\Fields\Dimensions\Level34\ValidTillField;
use PhpTwinfield\Fields\RateField;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/ActivityQuantity.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace PhpTwinfield;

use PhpTwinfield\Fields\Level1234\Level34\BillableField;
use PhpTwinfield\Fields\Level1234\Level34\BillableLockedField;
use PhpTwinfield\Fields\Level1234\Level34\LabelField;
use PhpTwinfield\Fields\Level1234\Level34\MandatoryField;
use PhpTwinfield\Fields\Dimensions\Level34\BillableField;
use PhpTwinfield\Fields\Dimensions\Level34\BillableLockedField;
use PhpTwinfield\Fields\Dimensions\Level34\LabelField;
use PhpTwinfield\Fields\Dimensions\Level34\MandatoryField;
use PhpTwinfield\Fields\RateField;

/**
Expand Down
31 changes: 30 additions & 1 deletion src/ApiConnectors/ActivityApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpTwinfield\Request as Request;
use PhpTwinfield\Response\MappedResponseCollection;
use PhpTwinfield\Response\Response;
use PhpTwinfield\Response\ResponseException;
use PhpTwinfield\Services\FinderService;
use Webmozart\Assert\Assert;

Expand All @@ -30,7 +31,7 @@ class ActivityApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Activity|bool The requested activity or false if it can't be found.
* @return Activity The requested Activity or Activity object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): Activity
Expand Down Expand Up @@ -123,4 +124,32 @@ public function listAll(

return $this->mapListAll("Activity", $response->data, $activityArrayListAllTags);
}

/**
* Deletes a specific Activity based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Activity The deleted Activity or Activity object with error message if it can't be found.
* @throws Exception
*/
public function delete(string $code, Office $office): Activity
{
$activity = self::get($code, $office);

if ($activity->getResult() == 1) {
$activity->setStatusFromString("deleted");

try {
$activityDeleted = self::send($activity);
} catch (ResponseException $e) {
$activityDeleted = $e->getReturnedObject();
}

return $activityDeleted;
} else {
return $activity;
}
}
}
31 changes: 30 additions & 1 deletion src/ApiConnectors/ArticleApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpTwinfield\Request as Request;
use PhpTwinfield\Response\MappedResponseCollection;
use PhpTwinfield\Response\Response;
use PhpTwinfield\Response\ResponseException;
use PhpTwinfield\Services\FinderService;
use Webmozart\Assert\Assert;

Expand All @@ -30,7 +31,7 @@ class ArticleApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Article|bool The requested article or false if it can't be found.
* @return Article The requested Article or Article object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): Article
Expand Down Expand Up @@ -121,4 +122,32 @@ public function listAll(

return $this->mapListAll("Article", $response->data, $articleArrayListAllTags);
}

/**
* Deletes a specific Article based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Article The deleted Article or Article object with error message if it can't be found.
* @throws Exception
*/
public function delete(string $code, Office $office): Article
{
$article = self::get($code, $office);

if ($article->getResult() == 1) {
$article->setStatusFromString("deleted");

try {
$articleDeleted = self::send($article);
} catch (ResponseException $e) {
$articleDeleted = $e->getReturnedObject();
}

return $articleDeleted;
} else {
return $article;
}
}
}
31 changes: 30 additions & 1 deletion src/ApiConnectors/AssetMethodApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpTwinfield\Request as Request;
use PhpTwinfield\Response\MappedResponseCollection;
use PhpTwinfield\Response\Response;
use PhpTwinfield\Response\ResponseException;
use PhpTwinfield\Services\FinderService;
use Webmozart\Assert\Assert;

Expand All @@ -30,7 +31,7 @@ class AssetMethodApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return AssetMethod|bool The requested asset method or false if it can't be found.
* @return AssetMethod The requested AssetMethod or AssetMethod object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): AssetMethod
Expand Down Expand Up @@ -122,4 +123,32 @@ public function listAll(

return $this->mapListAll("AssetMethod", $response->data, $assetMethodArrayListAllTags);
}

/**
* Deletes a specific AssetMethod based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return AssetMethod The deleted AssetMethod or AssetMethod object with error message if it can't be found.
* @throws Exception
*/
public function delete(string $code, Office $office): AssetMethod
{
$assetMethod = self::get($code, $office);

if ($assetMethod->getResult() == 1) {
$assetMethod->setStatusFromString("deleted");

try {
$assetMethodDeleted = self::send($assetMethod);
} catch (ResponseException $e) {
$assetMethodDeleted = $e->getReturnedObject();
}

return $assetMethodDeleted;
} else {
return $assetMethod;
}
}
}
31 changes: 30 additions & 1 deletion src/ApiConnectors/CostCenterApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpTwinfield\Request as Request;
use PhpTwinfield\Response\MappedResponseCollection;
use PhpTwinfield\Response\Response;
use PhpTwinfield\Response\ResponseException;
use PhpTwinfield\Services\FinderService;
use Webmozart\Assert\Assert;

Expand All @@ -30,7 +31,7 @@ class CostCenterApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return CostCenter|bool The requested cost center or false if it can't be found.
* @return CostCenter The requested CostCenter or CostCenter object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): CostCenter
Expand Down Expand Up @@ -123,4 +124,32 @@ public function listAll(

return $this->mapListAll("CostCenter", $response->data, $costCenterArrayListAllTags);
}

/**
* Deletes a specific CostCenter based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return CostCenter The deleted CostCenter or CostCenter object with error message if it can't be found.
* @throws Exception
*/
public function delete(string $code, Office $office): CostCenter
{
$costCenter = self::get($code, $office);

if ($costCenter->getResult() == 1) {
$costCenter->setStatusFromString("deleted");

try {
$costCenterDeleted = self::send($costCenter);
} catch (ResponseException $e) {
$costCenterDeleted = $e->getReturnedObject();
}

return $costCenterDeleted;
} else {
return $costCenter;
}
}
}
2 changes: 1 addition & 1 deletion src/ApiConnectors/CurrencyApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CurrencyApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Currency|bool The requested currency or false if it can't be found.
* @return Currency The requested Currency or Currency object with error message if it can't be found.
* @throws Exception
*/

Expand Down
31 changes: 30 additions & 1 deletion src/ApiConnectors/CustomerApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpTwinfield\Request as Request;
use PhpTwinfield\Response\MappedResponseCollection;
use PhpTwinfield\Response\Response;
use PhpTwinfield\Response\ResponseException;
use PhpTwinfield\Services\FinderService;
use Webmozart\Assert\Assert;

Expand All @@ -31,7 +32,7 @@ class CustomerApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Customer|bool The requested customer or false if it can't be found.
* @return Customer The requested Customer or Customer object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): Customer
Expand Down Expand Up @@ -123,4 +124,32 @@ public function listAll(

return $this->mapListAll("Customer", $response->data, $customerListAllTags);
}

/**
* Deletes a specific Customer based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return Customer The deleted Customer or Customer object with error message if it can't be found.
* @throws Exception
*/
public function delete(string $code, Office $office): Customer
{
$customer = self::get($code, $office);

if ($customer->getResult() == 1) {
$customer->setStatusFromString("deleted");

try {
$customerDeleted = self::send($customer);
} catch (ResponseException $e) {
$customerDeleted = $e->getReturnedObject();
}

return $customerDeleted;
} else {
return $customer;
}
}
}
35 changes: 32 additions & 3 deletions src/ApiConnectors/DimensionGroupApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpTwinfield\Request as Request;
use PhpTwinfield\Response\MappedResponseCollection;
use PhpTwinfield\Response\Response;
use PhpTwinfield\Response\ResponseException;
use PhpTwinfield\Services\FinderService;
use Webmozart\Assert\Assert;

Expand All @@ -28,9 +29,9 @@ class DimensionGroupApiConnector extends BaseApiConnector
* Requests a specific DimensionGroup based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return DimensionGroup|bool The requested dimension group or false if it can't be found.
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return DimensionGroup The requested DimensionGroup or DimensionGroup object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): DimensionGroup
Expand Down Expand Up @@ -122,4 +123,32 @@ public function listAll(

return $this->mapListAll("DimensionGroup", $response->data, $dimensionGroupListAllTags);
}

/**
* Deletes a specific DimensionGroup based off the passed in code and optionally the office.
*
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return DimensionGroup The deleted DimensionGroup or DimensionGroup object with error message if it can't be found.
* @throws Exception
*/
public function delete(string $code, Office $office): DimensionGroup
{
$dimensionGroup = self::get($code, $office);

if ($dimensionGroup->getResult() == 1) {
$dimensionGroup->setStatusFromString("deleted");

try {
$dimensionGroupDeleted = self::send($dimensionGroup);
} catch (ResponseException $e) {
$dimensionGroupDeleted = $e->getReturnedObject();
}

return $dimensionGroupDeleted;
} else {
return $dimensionGroup;
}
}
}
2 changes: 1 addition & 1 deletion src/ApiConnectors/DimensionTypeApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DimensionTypeApiConnector extends BaseApiConnector
* @param string $code
* @param Office $office If no office has been passed it will instead take the default office from the
* passed in config class.
* @return DimensionType|bool The requested dimension type or false if it can't be found.
* @return DimensionType The requested DimensionType or DimensionType object with error message if it can't be found.
* @throws Exception
*/
public function get(string $code, Office $office): DimensionType
Expand Down
Loading