How to use exceptions class

Best Atoum code snippet using exceptions

ConsignmentsManager.php

Source:ConsignmentsManager.php Github

copy

Full Screen

1<?php2namespace SimpleSquid\Vend\Actions;3use SimpleSquid\Vend\Resources\TwoDotZero\Consignment;4use SimpleSquid\Vend\Resources\TwoDotZero\ConsignmentCollection;5use SimpleSquid\Vend\Resources\TwoDotZero\InventoryCount;6use SimpleSquid\Vend\Resources\TwoDotZero\InventoryCountItem;7use SimpleSquid\Vend\Resources\TwoDotZero\InventoryCountItemCollection;8use SimpleSquid\Vend\Resources\TwoDotZero\InventoryCountItemRequest;9use SimpleSquid\Vend\Resources\ZeroDotNine\ConsignmentBase;10use SimpleSquid\Vend\Resources\ZeroDotNine\ConsignmentProduct;11use SimpleSquid\Vend\Resources\ZeroDotNine\ConsignmentProductBase;12class ConsignmentsManager13{14 use ManagesResources;15 /**16 * Create a consignment product.17 * Adds a new product to a consignment.18 *19 * @param ConsignmentProductBase|array $consignmentProduct20 *21 * @return \SimpleSquid\Vend\Resources\ZeroDotNine\ConsignmentProduct22 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException23 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException24 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException25 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException26 * @throws \SimpleSquid\Vend\Exceptions\RequestException27 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException28 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException29 * @throws \SimpleSquid\Vend\Exceptions\UnknownException30 */31 public function addProduct($consignmentProduct): ConsignmentProduct32 {33 if ($consignmentProduct instanceof ConsignmentProductBase) {34 $consignmentProduct = $consignmentProduct->toArray();35 }36 return $this->createResource(ConsignmentProduct::class, 'consignment_product', $consignmentProduct, null);37 }38 /**39 * Create a consignment.40 * Creates a new consignment.41 *42 * @param ConsignmentBase|array $consignment43 *44 * @return \SimpleSquid\Vend\Resources\ZeroDotNine\Consignment45 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException46 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException47 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException48 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException49 * @throws \SimpleSquid\Vend\Exceptions\RequestException50 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException51 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException52 * @throws \SimpleSquid\Vend\Exceptions\UnknownException53 */54 public function create($consignment): \SimpleSquid\Vend\Resources\ZeroDotNine\Consignment55 {56 if ($consignment instanceof ConsignmentBase) {57 $consignment = $consignment->toArray();58 }59 return $this->createResource(\SimpleSquid\Vend\Resources\ZeroDotNine\Consignment::class, 'consignment', $consignment, null);60 }61 /**62 * Create an inventory count.63 * Creates a new consignment of type `STOCKTAKE`. Currently, this endpoint only supports creation of inventory counts (stock takes).64 *65 * @param InventoryCount|array $inventoryCount66 *67 * @return Consignment68 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException69 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException70 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException71 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException72 * @throws \SimpleSquid\Vend\Exceptions\RequestException73 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException74 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException75 * @throws \SimpleSquid\Vend\Exceptions\UnknownException76 */77 public function createInventoryCount($inventoryCount): Consignment78 {79 if ($inventoryCount instanceof InventoryCount) {80 $inventoryCount = $inventoryCount->toArray();81 }82 return $this->createResource(Consignment::class, '2.0/consignments', $inventoryCount);83 }84 /**85 * Delete a consignment.86 * Deletes the consignment with the given ID.87 *88 * @param string $id Valid consignment ID.89 *90 * @return bool91 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException92 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException93 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException94 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException95 * @throws \SimpleSquid\Vend\Exceptions\RequestException96 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException97 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException98 * @throws \SimpleSquid\Vend\Exceptions\UnknownException99 */100 public function delete(string $id): bool101 {102 return $this->deleteResource("2.0/consignments/$id");103 }104 /**105 * Delete an item from an inventory count.106 * Removes the count for a specific product from the inventory count.107 *108 * @param string $consignment_id Valid consignment (inventory count) ID.109 * @param string $product_id The ID of a product included in the inventory count110 *111 * @return bool112 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException113 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException114 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException115 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException116 * @throws \SimpleSquid\Vend\Exceptions\RequestException117 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException118 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException119 * @throws \SimpleSquid\Vend\Exceptions\UnknownException120 */121 public function deleteProduct(string $consignment_id, string $product_id): bool122 {123 return $this->deleteResource("2.0/consignments/$consignment_id/products/$product_id");124 }125 /**126 * Get a single consignment.127 * Returns a single consignment with the requested ID.128 *129 * @param string $id Valid consignment ID.130 *131 * @return Consignment132 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException133 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException134 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException135 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException136 * @throws \SimpleSquid\Vend\Exceptions\RequestException137 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException138 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException139 * @throws \SimpleSquid\Vend\Exceptions\UnknownException140 */141 public function find(string $id): Consignment142 {143 return $this->single(Consignment::class, "2.0/consignments/$id");144 }145 /**146 * List consignments.147 * Returns a paginated list of consignments.148 *149 * @param int|null $page_size The maximum number of items to be returned in the response.150 * @param int|null $after The lower limit for the version numbers to be included in the response.151 * @param int|null $before The upper limit for the version numbers to be included in the response.152 * @param string|null $outlet_id The ID of the outlet which the consignment is targeted at.153 * @param string|null $type The type of consignments to be returned. One of `SUPPLIER`, `OUTLET`, `STOCKTAKE`.154 * @param string|null $status The status of consignments to be returned. One of `RECEIVED`, `CANCELLED`, `OPEN`, `STOCKTAKE`, `SENT`, `STOCKTAKE_COMPLETE`, `STOCKTAKE_IN_PROGRESS`, `STOCKTAKE_SCHEDULED`, `STOCKTAKE_IN_PROGRESS_PROCESSED`.155 *156 * @return ConsignmentCollection157 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException158 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException159 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException160 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException161 * @throws \SimpleSquid\Vend\Exceptions\RequestException162 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException163 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException164 * @throws \SimpleSquid\Vend\Exceptions\UnknownException165 */166 public function get(167 int $page_size = null,168 int $after = null,169 int $before = null,170 string $outlet_id = null,171 string $type = null,172 string $status = null173 ): ConsignmentCollection {174 return $this->collection(ConsignmentCollection::class, '2.0/consignments',175 compact('after', 'before', 'page_size', 'outlet_id', 'type', 'status'));176 }177 /**178 * List all products for a specific consignment.179 * Returns a collection of consignment products associated with the specified consignment.180 *181 * @param string $consignment_id The ID of the consignment for which products should be listed.182 * @param int|null $page_size The maximum number of items to be returned in the response.183 * @param int|null $after The lower limit for the version numbers to be included in the response.184 * @param int|null $before The upper limit for the version numbers to be included in the response.185 *186 * @return InventoryCountItemCollection187 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException188 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException189 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException190 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException191 * @throws \SimpleSquid\Vend\Exceptions\RequestException192 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException193 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException194 * @throws \SimpleSquid\Vend\Exceptions\UnknownException195 */196 public function products(197 string $consignment_id,198 int $page_size = null,199 int $after = null,200 int $before = null201 ): InventoryCountItemCollection {202 return $this->collection(InventoryCountItemCollection::class, "2.0/consignments/$consignment_id/products",203 compact('after', 'before', 'page_size'));204 }205 /**206 * Update a consignment.207 * Updates a consignment with the given ID.208 *209 * @param string $id The ID of the consignment to be updated.210 * @param ConsignmentBase|array $consignment211 *212 * @return \SimpleSquid\Vend\Resources\ZeroDotNine\Consignment213 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException214 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException215 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException216 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException217 * @throws \SimpleSquid\Vend\Exceptions\RequestException218 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException219 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException220 * @throws \SimpleSquid\Vend\Exceptions\UnknownException221 */222 public function update(string $id, $consignment): \SimpleSquid\Vend\Resources\ZeroDotNine\Consignment223 {224 if ($consignment instanceof ConsignmentBase) {225 $consignment = $consignment->toArray();226 }227 return $this->updateResource(\SimpleSquid\Vend\Resources\ZeroDotNine\Consignment::class, "consignment/$id", $consignment, null);228 }229 /**230 * Update an inventory count.231 * Updates the inventory count with requested ID.232 *233 * @param string $id Valid consignment ID.234 * @param InventoryCount|array $inventoryCount235 *236 * @return Consignment237 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException238 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException239 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException240 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException241 * @throws \SimpleSquid\Vend\Exceptions\RequestException242 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException243 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException244 * @throws \SimpleSquid\Vend\Exceptions\UnknownException245 */246 public function updateInventoryCount(string $id, $inventoryCount): Consignment247 {248 if ($inventoryCount instanceof InventoryCount) {249 $inventoryCount = $inventoryCount->toArray();250 }251 return $this->updateResource(Consignment::class, "2.0/consignments/$id", $inventoryCount);252 }253 /**254 * Adjust the inventory item count.255 * Increases or decreases the count for a specific product within the inventory count.256 *257 * @param string $consignment_id Valid consignment ID.258 * @param InventoryCountItemRequest|array $inventoryCountItem259 *260 * @return InventoryCountItem261 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException262 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException263 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException264 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException265 * @throws \SimpleSquid\Vend\Exceptions\RequestException266 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException267 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException268 * @throws \SimpleSquid\Vend\Exceptions\UnknownException269 */270 public function updateInventoryCountItem(string $consignment_id, array $inventoryCountItem): InventoryCountItem271 {272 if ($inventoryCountItem instanceof InventoryCountItemRequest) {273 $inventoryCountItem = $inventoryCountItem->toArray();274 }275 return $this->updateResource(InventoryCountItem::class, "2.0/consignments/$consignment_id/products", $inventoryCountItem);276 }277 /**278 * Update a consignment product.279 * Updates an existing consignment product.280 *281 * @param string $consignment_product_id The ID of the consignment product to be updated.282 * @param ConsignmentProductBase|array $consignmentProduct283 *284 * @return \SimpleSquid\Vend\Resources\ZeroDotNine\ConsignmentProduct285 * @throws \SimpleSquid\Vend\Exceptions\AuthorisationException286 * @throws \SimpleSquid\Vend\Exceptions\BadRequestException287 * @throws \SimpleSquid\Vend\Exceptions\NotFoundException288 * @throws \SimpleSquid\Vend\Exceptions\RateLimitException289 * @throws \SimpleSquid\Vend\Exceptions\RequestException290 * @throws \SimpleSquid\Vend\Exceptions\TokenExpiredException291 * @throws \SimpleSquid\Vend\Exceptions\UnauthorisedException292 * @throws \SimpleSquid\Vend\Exceptions\UnknownException293 */294 public function updateProduct(string $consignment_product_id, array $consignmentProduct): ConsignmentProduct295 {296 if ($consignmentProduct instanceof ConsignmentProductBase) {297 $consignmentProduct = $consignmentProduct->toArray();298 }299 return $this->updateResource(ConsignmentProduct::class, "consignment_product/$consignment_product_id", $consignmentProduct, null);300 }301}...

Full Screen

Full Screen

ErrorHandler.php

Source:ErrorHandler.php Github

copy

Full Screen

1<?php2declare(strict_types=1);3/*4 * This software may be modified and distributed under the terms5 * of the MIT license. See the LICENSE file for details.6 */7namespace Shapin\Stripe;8use Shapin\Stripe\Exception\Domain as DomainExceptions;9use Shapin\Stripe\Exception\DomainException;10use Symfony\Contracts\HttpClient\ResponseInterface;11final class ErrorHandler12{13 public static $errorCodes = [14 'account_already_exists' => DomainExceptions\BadRequestException::class,15 'account_country_invalid_address' => DomainExceptions\BadRequestException::class,16 'account_invalid' => DomainExceptions\BadRequestException::class,17 'account_number_invalid' => DomainExceptions\BadRequestException::class,18 'alipay_upgrade_required' => DomainExceptions\BadRequestException::class,19 'amount_too_large' => DomainExceptions\BadRequestException::class,20 'amount_too_small' => DomainExceptions\BadRequestException::class,21 'api_key_expired' => DomainExceptions\BadRequestException::class,22 'balance_insufficient' => DomainExceptions\BadRequestException::class,23 'bank_account_exists' => DomainExceptions\BadRequestException::class,24 'bank_account_unusable' => DomainExceptions\BadRequestException::class,25 'bank_account_unverified' => DomainExceptions\BadRequestException::class,26 'bitcoin_upgrade_required' => DomainExceptions\BadRequestException::class,27 'charge_already_captured' => DomainExceptions\BadRequestException::class,28 'charge_already_refunded' => DomainExceptions\ChargeAlreadyRefundedException::class,29 'charge_disputed' => DomainExceptions\BadRequestException::class,30 'charge_exceeds_source_limit' => DomainExceptions\BadRequestException::class,31 'charge_expired_for_capture' => DomainExceptions\BadRequestException::class,32 'country_unsupported' => DomainExceptions\BadRequestException::class,33 'coupon_expired' => DomainExceptions\BadRequestException::class,34 'customer_max_subscriptions' => DomainExceptions\BadRequestException::class,35 'email_invalid' => DomainExceptions\BadRequestException::class,36 'expired_card' => DomainExceptions\BadRequestException::class,37 'idempotency_key_in_use' => DomainExceptions\BadRequestException::class,38 'incorrect_address' => DomainExceptions\BadRequestException::class,39 'incorrect_cvc' => DomainExceptions\IncorrectCvcException::class,40 'incorrect_number' => DomainExceptions\IncorrectNumberException::class,41 'incorrect_zip' => DomainExceptions\BadRequestException::class,42 'instant_payouts_unsupported' => DomainExceptions\BadRequestException::class,43 'invalid_card_type' => DomainExceptions\BadRequestException::class,44 'invalid_charge_amount' => DomainExceptions\BadRequestException::class,45 'invalid_cvc' => DomainExceptions\BadRequestException::class,46 'invalid_expiry_month' => DomainExceptions\BadRequestException::class,47 'invalid_expiry_year' => DomainExceptions\BadRequestException::class,48 'invalid_number' => DomainExceptions\BadRequestException::class,49 'invalid_source_usage' => DomainExceptions\BadRequestException::class,50 'invoice_no_customer_line_items' => DomainExceptions\BadRequestException::class,51 'invoice_no_subscription_line_items' => DomainExceptions\BadRequestException::class,52 'invoice_not_editable' => DomainExceptions\BadRequestException::class,53 'invoice_upcoming_none' => DomainExceptions\BadRequestException::class,54 'livemode_mismatch' => DomainExceptions\BadRequestException::class,55 'missing' => DomainExceptions\BadRequestException::class,56 'not_allowed_on_standard_account' => DomainExceptions\BadRequestException::class,57 'order_creation_failed' => DomainExceptions\BadRequestException::class,58 'order_required_settings' => DomainExceptions\BadRequestException::class,59 'order_status_invalid' => DomainExceptions\BadRequestException::class,60 'order_upstream_timeout' => DomainExceptions\BadRequestException::class,61 'out_of_inventory' => DomainExceptions\BadRequestException::class,62 'parameter_invalid_empty' => DomainExceptions\BadRequestException::class,63 'parameter_invalid_integer' => DomainExceptions\BadRequestException::class,64 'parameter_invalid_string_blank' => DomainExceptions\BadRequestException::class,65 'parameter_invalid_string_empty' => DomainExceptions\BadRequestException::class,66 'parameter_missing' => DomainExceptions\BadRequestException::class,67 'parameter_unknown' => DomainExceptions\BadRequestException::class,68 'parameters_exclusive' => DomainExceptions\BadRequestException::class,69 'payment_intent_authentication_failure' => DomainExceptions\BadRequestException::class,70 'payment_intent_incompatible_payment_method' => DomainExceptions\BadRequestException::class,71 'payment_intent_invalid_parameter' => DomainExceptions\BadRequestException::class,72 'payment_intent_payment_attempt_failed' => DomainExceptions\BadRequestException::class,73 'payment_intent_unexpected_state' => DomainExceptions\BadRequestException::class,74 'payment_method_unactivated' => DomainExceptions\BadRequestException::class,75 'payment_method_unexpected_state' => DomainExceptions\BadRequestException::class,76 'payouts_not_allowed' => DomainExceptions\BadRequestException::class,77 'platform_api_key_expired' => DomainExceptions\BadRequestException::class,78 'postal_code_invalid' => DomainExceptions\BadRequestException::class,79 'processing_error' => DomainExceptions\BadRequestException::class,80 'product_inactive' => DomainExceptions\BadRequestException::class,81 'rate_limit' => DomainExceptions\BadRequestException::class,82 'resource_already_exists' => DomainExceptions\ResourceAlreadyExistsException::class,83 'resource_missing' => DomainExceptions\BadRequestException::class,84 'routing_number_invalid' => DomainExceptions\BadRequestException::class,85 'secret_key_required' => DomainExceptions\BadRequestException::class,86 'sepa_unsupported_account' => DomainExceptions\BadRequestException::class,87 'shipping_calculation_failed' => DomainExceptions\BadRequestException::class,88 'sku_inactive' => DomainExceptions\BadRequestException::class,89 'state_unsupported' => DomainExceptions\BadRequestException::class,90 'tax_id_invalid' => DomainExceptions\BadRequestException::class,91 'taxes_calculation_failed' => DomainExceptions\BadRequestException::class,92 'testmode_charges_only' => DomainExceptions\BadRequestException::class,93 'tls_version_unsupported' => DomainExceptions\BadRequestException::class,94 'token_already_used' => DomainExceptions\BadRequestException::class,95 'token_in_use' => DomainExceptions\BadRequestException::class,96 'transfers_not_allowed' => DomainExceptions\BadRequestException::class,97 'upstream_order_creation_failed' => DomainExceptions\BadRequestException::class,98 'url_invalid' => DomainExceptions\BadRequestException::class,99 ];100 public static $cardDeclinedCodes = [101 'card_not_supported' => DomainExceptions\CardDeclined\CardNotSupportedException::class,102 'expired_card' => DomainExceptions\CardDeclined\ExpiredCardException::class,103 'incorrect_cvc' => DomainExceptions\CardDeclined\IncorrectCvcException::class,104 'incorrect_number' => DomainExceptions\CardDeclined\IncorrectNumberException::class,105 'invalid_cvc' => DomainExceptions\CardDeclined\IncorrectCvcException::class,106 'invalid_number' => DomainExceptions\CardDeclined\IncorrectNumberException::class,107 'insufficient_funds' => DomainExceptions\CardDeclined\InsufficientFundsException::class,108 ];109 public function handle(ResponseInterface $response): void110 {111 $data = json_decode($response->getContent(false), true);112 if (\JSON_ERROR_NONE !== json_last_error()) {113 throw $this->getExceptionForStatusCode($response);114 }115 if (!\array_key_exists('error', $data)) {116 throw $this->getExceptionForStatusCode($response);117 }118 if (!\array_key_exists('code', $data['error'])) {119 throw $this->getExceptionForStatusCode($response);120 }121 $errorCode = $data['error']['code'];122 if (\array_key_exists($errorCode, self::$errorCodes)) {123 throw new self::$errorCodes[$errorCode]($response);124 }125 // We have a lot of decline codes for "card_declined" errors.126 if ('card_declined' === $errorCode) {127 $declineCode = $data['error']['decline_code'];128 if (\array_key_exists($declineCode, self::$cardDeclinedCodes)) {129 throw new self::$cardDeclinedCodes[$declineCode]($response);130 }131 throw new DomainExceptions\CardDeclinedException($response);132 }133 throw $this->getExceptionForStatusCode($response);134 }135 private function getExceptionForStatusCode(ResponseInterface $response): DomainException136 {137 switch ($response->getStatusCode()) {138 case 400:139 return new DomainExceptions\BadRequestException($response);140 case 404:141 return new DomainExceptions\NotFoundException();142 default:143 return new DomainExceptions\UnknownErrorException($response);144 }145 }146}...

Full Screen

Full Screen

exceptions.conf.php

Source:exceptions.conf.php Github

copy

Full Screen

...7 * @category PHP8 * @package PHP_CompatInfo9 * @author Laurent Laville <pear@laurent-laville.org>10 * @license http://www.opensource.org/licenses/bsd-license.php BSD11 * @version CVS: $Id: exceptions.conf.php,v 1.21 2009/01/03 10:19:22 farell Exp $12 * @link http://pear.php.net/package/PHP_CompatInfo13 * @since File available since Release 1.9.0b114 */15/* default version for each extension16 if not defined, then suppose its 4.0.0 */17$version_exceptions = array('bz2' => '4.0.4',18 'com_dotnet' => '5.0.0',19 'curl' => '4.0.2',20 'dom' => '5.0.0',21 'exif' => '4.2.0',22 'fileinfo' => '5.3.0',23 'filter' => '5.2.0',24 'gmp' => '4.0.4',25 'json' => '5.2.0',26 'libxml' => '5.1.0',27 'openssl' => '4.0.4',28 'pcre' => '4.0.0',29 'PDO' => '5.1.0',30 'phar' => '5.3.0',31 'pspell' => '4.0.2',32 'Reflection' => '5.0.0',33 'shmop' => '4.0.3',34 'sockets' => '4.0.2',35 'SimpleXML' => '5.0.0',36 'SPL' => '5.0.0',37 'standard' => '4.0.0',38 'xsl' => '5.0.0',39 'xmlreader' => '5.1.0',40 'xmlwriter' => '5.1.2',41 );42/* if default version is not 4.0.0, then we can fix the right43 constant initial version here */44require_once 'constant_exceptions.php';45require_once 'calendar_const_exceptions.php';46require_once 'date_const_exceptions.php';47require_once 'ftp_const_exceptions.php';48require_once 'gd_const_exceptions.php';49require_once 'gmp_const_exceptions.php';50require_once 'iconv_const_exceptions.php';51require_once 'mysql_const_exceptions.php';52require_once 'mysqli_const_exceptions.php';53require_once 'openssl_const_exceptions.php';54require_once 'pcre_const_exceptions.php';55require_once 'standard_const_exceptions.php';56require_once 'xsl_const_exceptions.php';57/* if default version is not 4.0.0, then we can fix the right58 predefined class initial version here */59require_once 'class_exceptions.php';60require_once 'date_class_exceptions.php';61require_once 'standard_class_exceptions.php';62/* if default is not from PHP core version 4.0.0, then we can fix the right63 function data here */64require_once 'function_exceptions.php';65require_once 'calendar_func_exceptions.php';66require_once 'date_func_exceptions.php';67require_once 'gd_func_exceptions.php';68require_once 'gettext_func_exceptions.php';69require_once 'hash_func_exceptions.php';70require_once 'iconv_func_exceptions.php';71require_once 'libxml_func_exceptions.php';72require_once 'spl_func_exceptions.php';73require_once 'standard_func_exceptions.php';74require_once 'xmlwriter_func_exceptions.php';75require_once 'zlib_func_exceptions.php';76/**77 * Function that provides to return exceptions results78 *79 * @param string $extension Extension name80 * @param sting $type Type of exception (version | class | constant)81 *82 * @return mixed Return false if no exception exists for this $extension and $type83 */84function getExceptions($extension, $type)85{86 global $version_exceptions, $class_exceptions, $function_exceptions, $constant_exceptions;87 $exceptions = false;88 switch ($type) {89 case 'version' :90 if (isset($version_exceptions[$extension])) {91 $exceptions = $version_exceptions[$extension];92 }93 break;94 case 'class' :95 if (isset($class_exceptions[$extension])) {96 $exceptions = $class_exceptions[$extension];97 }98 break;99 case 'function' :100 if (isset($function_exceptions[$extension])) {101 $exceptions = $function_exceptions[$extension];102 }103 break;104 case 'constant' :105 if (isset($constant_exceptions[$extension])) {106 $exceptions = $constant_exceptions[$extension];107 }108 }109 return $exceptions;110}111?>...

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1$script->addDefaultReport();2$script->addDefaultReport();3$script->addDefaultReport();4$script->addDefaultReport();5$script->addDefaultReport();6$script->addDefaultReport();7$script->addDefaultReport();8$script->addDefaultReport();9$script->addDefaultReport();10$script->addDefaultReport();11$script->addDefaultReport();12$script->addDefaultReport();13$script->addDefaultReport();14$script->addDefaultReport();15$script->addDefaultReport();16$script->addDefaultReport();17$script->addDefaultReport();18$script->addDefaultReport();19$script->addDefaultReport();20$script->addDefaultReport();

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1use \mageekguy\atoum\exceptions;2use \mageekguy\atoum\asserters;3use \mageekguy\atoum\test;4use \mageekguy\atoum\tools;5use \mageekguy\atoum\asserters;6use \mageekguy\atoum\mock;7use \mageekguy\atoum\php;8use \mageekguy\atoum\writers;9use \mageekguy\atoum\reports;10use \mageekguy\atoum\php;11use \mageekguy\atoum\writers;12use \mageekguy\atoum\reports;13use \mageekguy\atoum\php;14use \mageekguy\atoum\writers;15use \mageekguy\atoum\reports;16use \mageekguy\atoum\php;17use \mageekguy\atoum\writers;18use \mageekguy\atoum\reports;19use \mageekguy\atoum\php;20use \mageekguy\atoum\writers;

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1require_once 'atoum/exceptions.php';2require_once 'atoum/test.php';3require_once 'atoum/test.php';4require_once 'atoum/test.php';5require_once 'atoum/test.php';6require_once 'atoum/test.php';7require_once 'atoum/test.php';8require_once 'atoum/test.php';9require_once 'atoum/test.php';10require_once 'atoum/test.php';11require_once 'atoum/test.php';12require_once 'atoum/test.php';13require_once 'atoum/test.php';14require_once 'atoum/test.php';15require_once 'atoum/test.php';16require_once 'atoum/test.php';17require_once 'atoum/test.php';18require_once 'atoum/test.php';19require_once 'atoum/test.php';20require_once 'atoum/test.php';21require_once 'atoum/test.php';22require_once 'atoum/test.php';23require_once 'atoum/test.php';24require_once 'atoum/test.php';25require_once 'atoum/test.php';

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1include 'atoum.php';2{3 public function testException()4 {5 ->exception(function() { throw new \Exception('test'); })6 ->hasMessage('test')7 ;8 }9}10$test = new test();11$test->testException();12include 'atoum.php';13{14 public function testException()15 {16 ->exception(function() { throw new \Exception('test'); })17 ->hasMessage('test')18 ;19 }20}21$test = new test();22$test->testException();23include 'atoum.php';24{25 public function testException()26 {27 ->exception(function() { throw new \Exception('test'); })28 ->hasMessage('test')29 ;30 }31}32$test = new test();33$test->testException();34include 'atoum.php';35{36 public function testException()37 {38 ->exception(function() { throw new \Exception('test'); })39 ->hasMessage('test')40 ;41 }42}43$test = new test();44$test->testException();45include 'atoum.php';46{47 public function testException()48 {49 ->exception(function() { throw new \Exception('test'); })50 ->hasMessage('test')51 ;52 }53}54$test = new test();55$test->testException();56include 'atoum.php';57{58 public function testException()59 {60 ->exception(function() { throw new \Exception('test'); })61 ->hasMessage('test')62 ;63 }64}65$test = new test();66$test->testException();

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1use \mageekguy\atoum;2{3 public function testOne()4 {5 ->exception(function() {6 $this->testedClass->test();7 })8 ->isInstanceOf('Exception')9 ->hasMessage('An exception has been raised')10 ;11 }12}13use \mageekguy\atoum;14{15 public function testTwo()16 {17 ->exception(function() {18 $this->testedClass->test();19 })20 ->isInstanceOf('Exception')21 ->hasMessage('An exception has been raised')22 ;23 }24}25use \mageekguy\atoum;26{27 public function testThree()28 {29 ->exception(function() {30 $this->testedClass->test();31 })32 ->isInstanceOf('Exception')33 ->hasMessage('An exception has been raised')34 ;35 }36}37use \mageekguy\atoum;38{39 public function testFour()40 {41 ->exception(function() {42 $this->testedClass->test();43 })44 ->isInstanceOf('Exception')45 ->hasMessage('An exception has been raised')46 ;47 }48}49use \mageekguy\atoum;50{51 public function testFive()52 {53 ->exception(function() {54 $this->testedClass->test();55 })56 ->isInstanceOf('Exception')57 ->hasMessage('An exception has been raised')58 ;59 }60}61use \mageekguy\atoum;62{63 public function testSix()64 {65 ->exception(function() {

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1use \mageekguy\atoum\exceptions;2$object = new \mageekguy\atoum\exceptions\logic\invalidArgument('message');3$object->getMessage();4$object->getArgument();5$object->getArgumentName();6$object->getArgumentPosition();7$object->getArgumentType();8$object->getExpectedArgumentType();9$object->getExpectedArgumentTypes();10$object->getExpectedArgumentTypesAsString();11$object->getExpectedType();12$object->getExpectedTypes();13$object->getExpectedTypesAsString();14$object->getType();15$object->getTypes();16$object->getTypesAsString();17$object->setArgument('argument');18$object->setArgumentName('argumentName');19$object->setArgumentPosition('argumentPosition');20$object->setArgumentType('argumentType');21$object->setExpectedArgumentType('expectedArgumentType');22$object->setExpectedArgumentTypes('expectedArgumentTypes');23$object->setExpectedType('expectedType');24$object->setExpectedTypes('expectedTypes');25$object->setType('type');26$object->setTypes('types');27$object->setTypesAsString('types

Full Screen

Full Screen

exceptions

Using AI Code Generation

copy

Full Screen

1use atoum\exceptions;2$test->getScore()->setIsFailOnException(false);3$test->getScore()->setIsFailOnUncompletedTest(false);4$test->getScore()->setIsFailOnFailures(false);5$test->getScore()->setIsFailOnErrors(false);6$test->getScore()->setIsFailOnSkippedMethods(false);7$test->getScore()->setIsFailOnUndefinedMethods(false);8$test->getScore()->setIsFailOnEmptyTest(false);9$test->getScore()->setIsFailOnBadExitCode(false);10$test->getScore()->setIsFailOnOutput(false);11$test->getScore()->setIsFailOnException(false);12$test->getScore()->setIsFailOnUncompletedTest(false);13$test->getScore()->setIsFailOnFailures(false);14$test->getScore()->setIsFailOnErrors(false);15$test->getScore()->setIsFailOnSkippedMethods(false);16$test->getScore()->setIsFailOnUndefinedMethods(false);17$test->getScore()->setIsFailOnEmptyTest(false);18$test->getScore()->setIsFailOnBadExitCode(false);19$test->getScore()->setIsFailOnOutput(false);20use atoum\exceptions;21$test->getScore()->setIsFailOnException(false);22$test->getScore()->setIsFailOnUncompletedTest(false);23$test->getScore()->setIsFailOnFailures(false);24$test->getScore()->setIsFailOnErrors(false);25$test->getScore()->setIsFailOnSkippedMethods(false);26$test->getScore()->setIsFailOnUndefinedMethods(false);27$test->getScore()->setIsFailOnEmptyTest(false);28$test->getScore()->setIsFailOnBadExitCode(false);29$test->getScore()->setIsFailOnOutput(false);30use atoum\exceptions;31$test->getScore()->setIsFailOnException(false);32$test->getScore()->setIsFailOnUncompletedTest(false);33$test->getScore()->setIsFailOnFailures(false);34$test->getScore()->setIsFailOnErrors(false);35$test->getScore()->setIs

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in exceptions

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful