How to use testClass method of inline class

Best Atoum code snippet using inline.testClass

CompareSourceCommandApiClassesTest.php

Source:CompareSourceCommandApiClassesTest.php Github

copy

Full Screen

1<?php2/**3 * Copyright © Magento, Inc. All rights reserved.4 * See COPYING.txt for license details.5 */6namespace Magento\SemanticVersionChecker\Test\Unit\Console\Command;7use Magento\SemanticVersionChecker\Test\Unit\Console\Command\CompareSourceCommandTest\AbstractTestCase;8/**9 * Test semantic version checker CLI command dealing with API classes.10 */11class CompareSourceCommandApiClassesTest extends AbstractTestCase12{13 /**14 * Test semantic version checker CLI command for classes that have the <kbd>api</kbd> annotation.15 *16 * @param string $pathToSourceCodeBefore17 * @param string $pathToSourceCodeAfter18 * @param string[] $expectedLogEntries19 * @param string $expectedOutput20 * @param string[] $unexpectedLogEntries21 * @return void22 * @throws \Exception23 * @dataProvider changesDataProvider24 */25 public function testExecute(26 $pathToSourceCodeBefore,27 $pathToSourceCodeAfter,28 $expectedLogEntries,29 $expectedOutput,30 $unexpectedLogEntries = []31 ) {32 $this->doTestExecute(33 $pathToSourceCodeBefore,34 $pathToSourceCodeAfter,35 $expectedLogEntries,36 $expectedOutput,37 $unexpectedLogEntries38 );39 }40 public function changesDataProvider()41 {42 $pathToFixtures = __DIR__ . '/CompareSourceCommandTest/_files/api-class';43 return [44 'api-class-new-class' => [45 $pathToFixtures . '/new-class/source-code-before',46 $pathToFixtures . '/new-class/source-code-after',47 [48 'Class (MINOR)',49 'Test\Vcs\TestClass | Class was added. | V014'50 ],51 'Minor change is detected.'52 ],53 'api-class-new-method' => [54 $pathToFixtures . '/new-method/source-code-before',55 $pathToFixtures . '/new-method/source-code-after',56 [57 'Class (MINOR)',58 'Test\Vcs\TestClass::testMethod | [public] Method has been added. | V015'59 ],60 'Minor change is detected.'61 ],62 'api-class-removed-class' => [63 $pathToFixtures . '/removed-class/source-code-before',64 $pathToFixtures . '/removed-class/source-code-after',65 [66 'Class (MAJOR)',67 'Test\Vcs\TestClass | Class was removed. | V005'68 ],69 'Major change is detected.'70 ],71 'api-class-removed-method' => [72 $pathToFixtures . '/removed-method/source-code-before',73 $pathToFixtures . '/removed-method/source-code-after',74 [75 'Class (MAJOR)',76 'Test\Vcs\TestClass::testMethod | [public] Method has been removed. | V006'77 ],78 'Major change is detected.'79 ],80 'api-class-new-required-method-parameter' => [81 $pathToFixtures . '/new-required-method-parameter/source-code-before',82 $pathToFixtures . '/new-required-method-parameter/source-code-after',83 [84 'Class (MAJOR)',85 'Test\Vcs\TestClass::testMethod | [public] Method parameter added. | V010'86 ],87 'Major change is detected.'88 ],89 'api-class-new-optional-method-parameter' => [90 $pathToFixtures . '/new-optional-method-parameter/source-code-before',91 $pathToFixtures . '/new-optional-method-parameter/source-code-after',92 [93 'Class (MINOR)',94 'Test\Vcs\TestClass::publicMethod | [public] Added optional parameter(s). | M102',95 'Test\Vcs\TestClass::protectedMethod | [protected] Added optional parameter(s). | M102',96 'Test\Vcs\TestClass::privateMethod | [private] Added optional parameter(s). | M102',97 'PATCH'98 ],99 'Minor change is detected.'100 ],101 'api-class-removed-optional-non-last-method-parameter' => [102 $pathToFixtures . '/removed-optional-non-last-method-parameter/source-code-before',103 $pathToFixtures . '/removed-optional-non-last-method-parameter/source-code-after',104 [105 'Class (MAJOR)',106 'Test\Vcs\TestClass::testMethod | [public] Method parameter name changed. | V060'107 ],108 'Major change is detected.'109 ],110 'api-class-removed-required-method-parameter-followed-by-optional-one' => [111 $pathToFixtures . '/removed-required-method-parameter-followed-by-optional-one/source-code-before',112 $pathToFixtures . '/removed-required-method-parameter-followed-by-optional-one/source-code-after',113 [114 'Class (MAJOR)',115 'Test\Vcs\TestClass::testMethod | [public] Method parameter name changed. | V060'116 ],117 'Major change is detected.'118 ],119 'api-class-removed-required-non-last-method-parameter' => [120 $pathToFixtures . '/removed-required-non-last-method-parameter/source-code-before',121 $pathToFixtures . '/removed-required-non-last-method-parameter/source-code-after',122 [123 'Class (MAJOR)',124 'Test\Vcs\TestClass::testMethod | [public] Method parameter removed. | V082'125 ],126 'Major change is detected.'127 ],128 'api-class-new-required-constructor-parameter' => [129 $pathToFixtures . '/new-required-constructor-parameter/source-code-before',130 $pathToFixtures . '/new-required-constructor-parameter/source-code-after',131 [132 'Class (MINOR)',133 'Test\Vcs\TestClass::__construct | [public] Added a required constructor object parameter. | M103'134 ],135 'Minor change is detected.'136 ],137 'api-class-new-required-constructor-parameter-for-extendable' => [138 $pathToFixtures . '/new-required-constructor-parameter-for-extendable/source-code-before',139 $pathToFixtures . '/new-required-constructor-parameter-for-extendable/source-code-after',140 [141 'Class (MINOR)',142 'Magento\Framework\Model\AbstractExtensibleModel::__construct | [public] Added a required constructor object parameter. | M103'143 ],144 'Minor change is detected.'145 ],146 'api-class-new-required-scalar-constructor-parameter-for-extendable' => [147 $pathToFixtures . '/new-required-scalar-constructor-parameter-for-extendable/source-code-before',148 $pathToFixtures . '/new-required-scalar-constructor-parameter-for-extendable/source-code-after',149 [150 'Class (MAJOR)',151 'Magento\Framework\Model\AbstractExtensibleModel::__construct | [public] Method parameter added. | V010'152 ],153 'Major change is detected.'154 ],155 'api-class-new-optional-scalar-constructor-parameter-for-extendable' => [156 $pathToFixtures . '/new-optional-scalar-constructor-parameter-for-extendable/source-code-before',157 $pathToFixtures . '/new-optional-scalar-constructor-parameter-for-extendable/source-code-after',158 [159 'Class (MINOR)',160 'Magento\Framework\Model\AbstractExtensibleModel::__construct | [public] Added an optional constructor parameter to extendable @api class. | M111'161 ],162 'Minor change is detected.'163 ],164 'api-class-new-optional-constructor-parameter-for-extendable' => [165 $pathToFixtures . '/new-optional-constructor-parameter-for-extendable/source-code-before',166 $pathToFixtures . '/new-optional-constructor-parameter-for-extendable/source-code-after',167 [168 'Class (MINOR)',169 'Magento\Framework\Model\AbstractExtensibleModel::__construct | [public] Added an optional constructor parameter to extendable @api class. | M111'170 ],171 'Minor change is detected.'172 ],173 'api-class-new-required-scalar-constructor-parameter' => [174 $pathToFixtures . '/new-required-scalar-constructor-parameter/source-code-before',175 $pathToFixtures . '/new-required-scalar-constructor-parameter/source-code-after',176 [177 'Class (MAJOR)',178 'Test\Vcs\TestClass::__construct | [public] Method parameter added. | V010'179 ],180 'Major change is detected.'181 ],182 'api-class-new-optional-constructor-parameter' => [183 $pathToFixtures . '/new-optional-constructor-parameter/source-code-before',184 $pathToFixtures . '/new-optional-constructor-parameter/source-code-after',185 [186 'Class (PATCH)',187 'Test\Vcs\TestClass::__construct | [public] Added an optional constructor parameter. | M112'188 ],189 'Patch change is detected.'190 ],191 'api-class-removed-non-last-constructor-parameter' => [192 $pathToFixtures . '/removed-non-last-constructor-parameter/source-code-before',193 $pathToFixtures . '/removed-non-last-constructor-parameter/source-code-after',194 [195 'Class (MAJOR)',196 'Test\Vcs\TestClass::__construct | [public] Method parameter removed. | V082'197 ],198 'Major change is detected.'199 ],200 'api-class-removed-last-constructor-parameter' => [201 $pathToFixtures . '/removed-last-constructor-parameter/source-code-before',202 $pathToFixtures . '/removed-last-constructor-parameter/source-code-after',203 [204 'Class (PATCH)',205 'Test\Vcs\TestClass::__construct | [public] Removed last constructor parameter(s). | M101'206 ],207 'Patch change is detected.'208 ],209 'api-class-removed-required-last-method-parameter' => [210 $pathToFixtures . '/removed-required-last-method-parameter/source-code-before',211 $pathToFixtures . '/removed-required-last-method-parameter/source-code-after',212 [213 'Class (MINOR)',214 'Test\Vcs\TestClass::publicMethod | [public] Removed last method parameter(s). | M100',215 'Test\Vcs\TestClass::protectedMethod | [protected] Removed last method parameter(s). | M100'216 ],217 'Minor change is detected.'218 ],219 'api-class-changed-method-parameter-type' => [220 $pathToFixtures . '/changed-method-parameter-type/source-code-before',221 $pathToFixtures . '/changed-method-parameter-type/source-code-after',222 [223 'Class (MAJOR)',224 'Test\Vcs\TestClass::testMethod | [public] Method parameter typing changed. | M113'225 ],226 'Major change is detected.'227 ],228 'api-class-changed-method-return-type' => [229 $pathToFixtures . '/changed-method-return-type/source-code-before',230 $pathToFixtures . '/changed-method-return-type/source-code-after',231 [232 'Class (MAJOR)',233 'Test\Vcs\TestClass::declarationAddedPublic | [public] Method return typing changed. | M120 ',234 'Test\Vcs\TestClass::declarationAddedProtected | [protected] Method return typing changed. | M121 ',235 'Test\Vcs\TestClass::declarationChangedPublic | [public] Method return typing changed. | M120 ',236 'Test\Vcs\TestClass::annotationChangedPublic | [public] Method return typing changed. | M120 ',237 'Test\Vcs\TestClass::declarationChangedProtected | [protected] Method return typing changed. | M121 ',238 'Test\Vcs\TestClass::annotationChangedProtected | [protected] Method return typing changed. | M121 ',239 'Test\Vcs\TestClass::declarationRemovedPublic | [public] Method return typing changed. | M120 ',240 'Test\Vcs\TestClass::annotationRemovedPublic | [public] Method return typing changed. | M120 ',241 'Test\Vcs\TestClass::declarationRemovedProtected | [protected] Method return typing changed. | M121 ',242 'Test\Vcs\TestClass::annotationRemovedProtected | [protected] Method return typing changed. | M121 ',243 'Test\Vcs\TestClass::php7RemoveAnnotationWithoutDoc | [public] Method return typing changed. | M120 ',244 'Test\Vcs\TestClass::declarationAddedPrivate | [private] Method return typing changed. | M122 ',245 'Test\Vcs\TestClass::declarationChangedPrivate | [private] Method return typing changed. | M122 ',246 'Test\Vcs\TestClass::annotationChangedPrivate | [private] Method return typing changed. | M122 ',247 'Test\Vcs\TestClass::declarationRemovedPrivate | [private] Method return typing changed. | M122 ',248 'Test\Vcs\TestClass::annotationRemovedPrivate | [private] Method return typing changed. | M122 ',249 'Test\Vcs\TestClass::toBeChangedClassReturnTypeInlineDeclaration | [public] Method return typing changed. | M120',250 'Test\Vcs\TestClass::nullableToBeChangedClassReturnTypeInlineDeclaration | [public] Method return typing changed. | M120'251 ],252 'Major change is detected.',253 [254 'Test\Vcs\TestClass::declarationFcqnNotChangedPublic | [public] Method return typing changed. | M120 ',255 'Test\Vcs\TestClass::declarationSelfNotChangedProtected | [protected] Method return typing changed. | M121 ',256 'Test\Vcs\TestClass::classReturnTypeInlineDeclaration | [public] Method return typing changed. | M120 ',257 'Test\Vcs\TestClass::nullableClassReturnTypeInlineDeclaration | [public] Method return typing changed. | M120 '258 ]259 ],260 'api-class-new-method-parameter-type' => [261 $pathToFixtures . '/new-method-parameter-type/source-code-before',262 $pathToFixtures . '/new-method-parameter-type/source-code-after',263 [264 'Class (MAJOR)',265 'Test\Vcs\TestClass::testMethod | [public] Method parameter typing added. | V085'266 ],267 'Major change is detected.'268 ],269 'api-class-removed-method-parameter-type' => [270 $pathToFixtures . '/removed-method-parameter-type/source-code-before',271 $pathToFixtures . '/removed-method-parameter-type/source-code-after',272 [273 'Class (MAJOR)',274 'Test\Vcs\TestClass::testMethod | [public] Method parameter typing removed. | V088'275 ],276 'Major change is detected.'277 ],278 'api-class-constant-added' => [279 $pathToFixtures . '/constant-added/source-code-before',280 $pathToFixtures . '/constant-added/source-code-after',281 [282 'Class (MINOR)',283 'Test\Vcs\TestClass::SOME_NEW_CONSTANCE | Constant has been added. | M071'284 ],285 'Minor change is detected.'286 ],287 'api-class-constant-removed' => [288 $pathToFixtures . '/constant-removed/source-code-before',289 $pathToFixtures . '/constant-removed/source-code-after',290 [291 'Class (MAJOR)',292 'Test\Vcs\TestClass::SOME_NEW_CONSTANCE | Constant has been removed. | M073'293 ],294 'Major change is detected.'295 ],296 'api-class-remove-extends' => [297 $pathToFixtures . '/remove-extends/source-code-before',298 $pathToFixtures . '/remove-extends/source-code-after',299 [300 'Class (MAJOR)',301 'Test\Vcs\TestClass | Extends has been removed. | M0122'302 ],303 'Major change is detected.'304 ],305 'api-class-remove-implements' => [306 $pathToFixtures . '/remove-implements/source-code-before',307 $pathToFixtures . '/remove-implements/source-code-after',308 [309 'Class (MAJOR)',310 'Test\Vcs\TestClass | Implements has been removed. | M0123'311 ],312 'Major change is detected.'313 ],314 'api-class-added-extends' => [315 $pathToFixtures . '/added-extends/source-code-before',316 $pathToFixtures . '/added-extends/source-code-after',317 [318 'Class (MINOR)',319 'Test\Vcs\TestClass | Parent has been added. | M0124'320 ],321 'Minor change is detected.'322 ],323 'api-class-added-implements' => [324 $pathToFixtures . '/added-implements/source-code-before',325 $pathToFixtures . '/added-implements/source-code-after',326 [327 'Class (MINOR)',328 'Test\Vcs\TestClass1 | Interface has been added. | M0125',329 'Test\Vcs\TestClass2 | Interface has been added. | M0125'330 ],331 'Minor change is detected.'332 ],333 'api-class-added-trait' => [334 $pathToFixtures . '/added-trait/source-code-before',335 $pathToFixtures . '/added-trait/source-code-after',336 [337 'Class (MINOR)',338 'Test\Vcs\TestClass1 | New trait has been used. | M0126',339 'Test\Vcs\TestClass2 | New trait has been used. | M0126'340 ],341 'Minor change is detected.'342 ],343 'api-class-exception-superclassed' => [344 $pathToFixtures . '/exception-superclassed/source-code-before',345 $pathToFixtures . '/exception-superclassed/source-code-after',346 [347 'Class (MAJOR)',348 'Test\Vcs\TestClass::exceptionSuperclassed | [public] Exception has been superclassed. | M127'349 ],350 'Major change is detected.'351 ],352 'api-class-exception-subclassed' => [353 $pathToFixtures . '/exception-subclassed/source-code-before',354 $pathToFixtures . '/exception-subclassed/source-code-after',355 [356 'Class (MINOR)',357 'Test\Vcs\TestClass::exceptionSubclassed | [public] Exception has been subclassed. | M129'358 ],359 'Minor change is detected.'360 ],361 'api-class-exception-superclass-added' => [362 $pathToFixtures . '/exception-superclass-added/source-code-before',363 $pathToFixtures . '/exception-superclass-added/source-code-after',364 [365 'Class (MAJOR)',366 'Test\Vcs\TestClass::exceptionSuperclassAdded | [public] Superclassed Exception has been added. | M131'367 ],368 'Major change is detected.'369 ],370 'api-class-exception-subclass-added' => [371 $pathToFixtures . '/exception-subclass-added/source-code-before',372 $pathToFixtures . '/exception-subclass-added/source-code-after',373 [374 'Suggested semantic versioning change: NONE'375 ],376 'Patch change is detected.'377 ],378 'api-moved-method-parameter-type-from-docblock-to-inline' => [379 $pathToFixtures . '/moved-method-parameter-type-from-docblock-to-inline/source-code-before',380 $pathToFixtures . '/moved-method-parameter-type-from-docblock-to-inline/source-code-after',381 [382 'Class (MAJOR)',383 'Test\Vcs\TestClass::movedNativeTypePublic | [public] Method parameter typehint was moved from doc block annotation to in-line. | M134',384 'Test\Vcs\TestClass::movedNonNativeTypePublic | [public] Method parameter typehint was moved from doc block annotation to in-line. | M134',385 'Test\Vcs\TestClass::movedNativeTypeProtected | [protected] Method parameter typehint was moved from doc block annotation to in-line. | M152',386 'Test\Vcs\TestClass::movedNativeTypePrivate | [private] Method parameter typehint was moved from doc block annotation to in-line. | M164',387 ],388 'Major change is detected.'389 ],390 'api-moved-method-parameter-type-from-inline-to-docblock' => [391 $pathToFixtures . '/moved-method-parameter-type-from-inline-to-docblock/source-code-before',392 $pathToFixtures . '/moved-method-parameter-type-from-inline-to-docblock/source-code-after',393 [394 'Class (MAJOR)',395 'Test\Vcs\TestClass::movedNativeTypePublic | [public] Method parameter typehint was moved from in-line to doc block annotation. | M135',396 'Test\Vcs\TestClass::movedNonNativeTypePublic | [public] Method parameter typehint was moved from in-line to doc block annotation. | M135',397 'Test\Vcs\TestClass::movedNativeTypeProtected | [protected] Method parameter typehint was moved from in-line to doc block annotation. | M154',398 'Test\Vcs\TestClass::movedNativeTypePrivate | [private] Method parameter typehint was moved from in-line to doc block annotation. | M166',399 ],400 'Major change is detected.'401 ],402 'api-moved-method-return-type-from-docblock-to-inline' => [403 $pathToFixtures . '/moved-method-return-type-from-docblock-to-inline/source-code-before',404 $pathToFixtures . '/moved-method-return-type-from-docblock-to-inline/source-code-after',405 [406 'Class (MAJOR)',407 'Test\Vcs\TestClass::movedNativeTypePublic | [public] Method return typehint was moved from doc block annotation to in-line. | M136',408 'Test\Vcs\TestClass::movedNonNativeTypePublic | [public] Method return typehint was moved from doc block annotation to in-line. | M136',409 'Test\Vcs\TestClass::movedNativeTypeProtected | [protected] Method return typehint was moved from doc block annotation to in-line. | M156',410 'Test\Vcs\TestClass::movedNativeTypePrivate | [private] Method return typehint was moved from doc block annotation to in-line. | M168',411 ],412 'Major change is detected.'413 ],414 'api-moved-method-return-type-from-inline-to-docblock' => [415 $pathToFixtures . '/moved-method-return-type-from-inline-to-docblock/source-code-before',416 $pathToFixtures . '/moved-method-return-type-from-inline-to-docblock/source-code-after',417 [418 'Class (MAJOR)',419 'Test\Vcs\TestClass::movedNativeTypePublic | [public] Method return typehint was moved from in-line to doc block annotation. | M137',420 'Test\Vcs\TestClass::movedNonNativeTypePublic | [public] Method return typehint was moved from in-line to doc block annotation. | M137',421 'Test\Vcs\TestClass::movedNativeTypeProtected | [protected] Method return typehint was moved from in-line to doc block annotation. | M158',422 'Test\Vcs\TestClass::movedNativeTypePrivate | [private] Method return typehint was moved from in-line to doc block annotation. | M170',423 ],424 'Major change is detected.'425 ],426 'api-moved-method-variable-type-from-docblock-to-inline' => [427 $pathToFixtures . '/moved-method-variable-type-from-docblock-to-inline/source-code-before',428 $pathToFixtures . '/moved-method-variable-type-from-docblock-to-inline/source-code-after',429 [430 'Class (MAJOR)',431 'Test\Vcs\TestClass::movedNativeTypePublic | [public] Method variable typehint was moved from doc block annotation to in-line. | M146',432 'Test\Vcs\TestClass::movedNonNativeTypePublic | [public] Method variable typehint was moved from doc block annotation to in-line. | M146',433 'Test\Vcs\TestClass::movedNativeTypeProtected | [protected] Method variable typehint was moved from doc block annotation to in-line. | M160',434 'Test\Vcs\TestClass::movedNativeTypePrivate | [private] Method variable typehint was moved from doc block annotation to in-line. | M172',435 ],436 'Major change is detected.'437 ],438 'api-moved-method-variable-type-from-inline-to-docblock' => [439 $pathToFixtures . '/moved-method-variable-type-from-inline-to-docblock/source-code-before',440 $pathToFixtures . '/moved-method-variable-type-from-inline-to-docblock/source-code-after',441 [442 'Class (MAJOR)',443 'Test\Vcs\TestClass::movedNativeTypePublic | [public] Method variable typehint was moved from in-line to doc block annotation. | M149',444 'Test\Vcs\TestClass::movedNonNativeTypePublic | [public] Method variable typehint was moved from in-line to doc block annotation. | M149',445 'Test\Vcs\TestClass::movedNativeTypeProtected | [protected] Method variable typehint was moved from in-line to doc block annotation. | M162',446 'Test\Vcs\TestClass::movedNativeTypePrivate | [private] Method variable typehint was moved from in-line to doc block annotation. | M174',447 ],448 'Major change is detected.'449 ],450 'api-class-added-method-subclass-overwrite' => [451 $pathToFixtures . '/added-method-subclass-overwrite/source-code-before',452 $pathToFixtures . '/added-method-subclass-overwrite/source-code-after',453 [454 'Class (PATCH)',455 'Test\Vcs\ApiClass::testFunction | [public] Method overwrite has been added. | V028'456 ],457 'Patch change is detected.'458 ],459 'api-annotation-added-to-class' => [460 $pathToFixtures . '/annotation-added/source-code-before',461 $pathToFixtures . '/annotation-added/source-code-after',462 [463 'Class (MINOR)',464 'Test\Vcs\TestClass | @api annotation has been added. | M0141',465 ],466 'Minor change is detected.',467 ],468 'api-annotation-removed-from-class' => [469 $pathToFixtures . '/annotation-removed/source-code-before',470 $pathToFixtures . '/annotation-removed/source-code-after',471 [472 'Class (MAJOR)',473 'Test\Vcs\TestClass | @api annotation has been removed. | M0142',474 ],475 'Major change is detected.',476 ],477 'api-annotation-not-changed' => [478 $pathToFixtures . '/annotation-not-changed/source-code-before',479 $pathToFixtures . '/annotation-not-changed/source-code-after',480 [481 'Suggested semantic versioning change: NONE',482 ],483 'Patch change is detected.',484 ],485 'api-class-added-method-subclass-overwrite-transition' => [486 $pathToFixtures . '/added-method-subclass-overwrite-transition/source-code-before',487 $pathToFixtures . '/added-method-subclass-overwrite-transition/source-code-after',488 [489 'Class (PATCH)',490 'Test\Vcs\ApiClass::testFunction | [public] Method overwrite has been added. | V028 |',491 'Test\Vcs\ApiClass::testFunctionProtected | [protected] Method overwrite has been added. | V028 |',492 'Test\Vcs\ApiClass::__construct | [public] Method overwrite has been added. | V028 |',493 'Test\Vcs\ApiClass::__destruct | [public] Method overwrite has been added. | V028 |',494 'Test\Vcs\ApiClass::__call | [public] Method overwrite has been added. | V028 |',495 'Test\Vcs\ApiClass::__callStatic | [public] Method overwrite has been added. | V028 |',496 'Test\Vcs\ApiClass::__get | [public] Method overwrite has been added. | V028 |',497 'Test\Vcs\ApiClass::__set | [public] Method overwrite has been added. | V028 |',498 'Test\Vcs\ApiClass::__isset | [public] Method overwrite has been added. | V028 |',499 'Test\Vcs\ApiClass::__unset | [public] Method overwrite has been added. | V028 |',500 'Test\Vcs\ApiClass::__sleep | [public] Method overwrite has been added. | V028 |',501 'Test\Vcs\ApiClass::__wakeup | [public] Method overwrite has been added. | V028 |',502 'Test\Vcs\ApiClass::__serialize | [public] Method overwrite has been added. | V028 |',503 'Test\Vcs\ApiClass::__unserialize | [public] Method overwrite has been added. | V028 |',504 'Test\Vcs\ApiClass::__toString | [public] Method overwrite has been added. | V028 |',505 'Test\Vcs\ApiClass::__invoke | [public] Method overwrite has been added. | V028 |',506 'Test\Vcs\ApiClass::__set_state | [public] Method overwrite has been added. | V028 |',507 'Test\Vcs\ApiClass::__clone | [public] Method overwrite has been added. | V028 |',508 'Test\Vcs\ApiClass::__debugInfo | [public] Method overwrite has been added. | V028 |',509 ],510 'Patch change is detected.'511 ],512 'protected-property-overwrite' => [513 $pathToFixtures . '/protected-property-overwrite/source-code-before',514 $pathToFixtures . '/protected-property-overwrite/source-code-after',515 [516 'Class (PATCH)',517 'Test\Vcs\TestClass::$_cacheTag | [protected] Property overwrite has been added. | M020'518 ],519 'Patch change is detected.'520 ],521 'public-property-overwrite' => [522 $pathToFixtures . '/public-property-overwrite/source-code-before',523 $pathToFixtures . '/public-property-overwrite/source-code-after',524 [525 'Class (PATCH)',526 'Test\Vcs\TestClass::$_cacheTag | [public] Property overwrite has been added. | M019'527 ],528 'Patch change is detected.'529 ],530 ];531 }532}...

Full Screen

Full Screen

LayoutEntityHelperTraitTest.php

Source:LayoutEntityHelperTraitTest.php Github

copy

Full Screen

1<?php2namespace Drupal\Tests\layout_builder\Unit;3use Drupal\Component\Plugin\ConfigurablePluginInterface;4use Drupal\Component\Plugin\DerivativeInspectionInterface;5use Drupal\Component\Plugin\PluginInspectionInterface;6use Drupal\Core\Entity\EntityInterface;7use Drupal\Core\Entity\FieldableEntityInterface;8use Drupal\layout_builder\LayoutEntityHelperTrait;9use Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage;10use Drupal\layout_builder\Section;11use Drupal\layout_builder\SectionComponent;12use Drupal\Tests\UnitTestCase;13/**14 * @coversDefaultClass \Drupal\layout_builder\LayoutEntityHelperTrait15 *16 * @group layout_builder17 */18class LayoutEntityHelperTraitTest extends UnitTestCase {19 /**20 * @covers ::isEntityUsingFieldOverride21 *22 * @dataProvider providerTestIsEntityUsingFieldOverride23 *24 * @expectedDeprecation \Drupal\layout_builder\LayoutEntityHelperTrait::isEntityUsingFieldOverride() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Internal storage of overrides may change so the existence of the field does not necessarily guarantee an overridable entity. See https://www.drupal.org/node/3030609.25 *26 * @group legacy27 */28 public function testIsEntityUsingFieldOverride(EntityInterface $entity, $expected) {29 $test_class = new TestClass();30 $this->assertSame($expected, $test_class->isEntityUsingFieldOverride($entity));31 }32 /**33 * Dataprovider for testIsEntityUsingFieldOverride().34 */35 public function providerTestIsEntityUsingFieldOverride() {36 $data['non fieldable entity'] = [37 $this->prophesize(EntityInterface::class)->reveal(),38 FALSE,39 ];40 $fieldable_entity = $this->prophesize(FieldableEntityInterface::class);41 $fieldable_entity->hasField(OverridesSectionStorage::FIELD_NAME)->willReturn(FALSE);42 $data['fieldable entity without layout field'] = [43 $fieldable_entity->reveal(),44 FALSE,45 ];46 $entity_using_field = $this->prophesize(FieldableEntityInterface::class);47 $entity_using_field->hasField(OverridesSectionStorage::FIELD_NAME)->willReturn(TRUE);48 $data['fieldable entity with layout field'] = [49 $entity_using_field->reveal(),50 TRUE,51 ];52 return $data;53 }54 /**55 * Dataprovider method for tests that need sections with inline blocks.56 */57 public function providerSectionsWithInlineComponents() {58 $components = [];59 // Ensure a non-derivative component is not returned.60 $non_derivative_component = $this->prophesize(SectionComponent::class);61 $non_derivative_component->getPlugin()->willReturn($this->prophesize(PluginInspectionInterface::class)->reveal());62 $components[] = $non_derivative_component->reveal();63 // Ensure a derivative component with a different base Id is not returned.64 $derivative_non_inline_component = $this->prophesize(SectionComponent::class);65 $plugin = $this->prophesize(DerivativeInspectionInterface::class);66 $plugin->getBaseId()->willReturn('some_other_base_id_which_we_do_not_care_about_but_it_is_nothing_personal');67 $derivative_non_inline_component->getPlugin()->willReturn($plugin);68 $components[] = $derivative_non_inline_component->reveal();69 // Ensure that inline block component is returned.70 $inline_component = $this->prophesize(SectionComponent::class);71 $inline_plugin = $this->prophesize(DerivativeInspectionInterface::class)->willImplement(ConfigurablePluginInterface::class);72 $inline_plugin->getBaseId()->willReturn('inline_block');73 $inline_plugin->getConfiguration()->willReturn(['block_revision_id' => 'the_revision_id']);74 $inline_component->getPlugin()->willReturn($inline_plugin->reveal());75 $inline_component = $inline_component->reveal();76 $components[] = $inline_component;77 // Ensure that inline block component without revision is returned.78 $inline_component_without_revision_id = $this->prophesize(SectionComponent::class);79 $inline_plugin_without_revision_id = $this->prophesize(DerivativeInspectionInterface::class)->willImplement(ConfigurablePluginInterface::class);80 $inline_plugin_without_revision_id->getBaseId()->willReturn('inline_block');81 $inline_plugin_without_revision_id->getConfiguration()->willReturn(['other_key' => 'other_value']);82 $inline_component_without_revision_id->getPlugin()->willReturn($inline_plugin_without_revision_id->reveal());83 $inline_component_without_revision_id = $inline_component_without_revision_id->reveal();84 $components[] = $inline_component_without_revision_id;85 $section = $this->prophesize(Section::class);86 $section->getComponents()->willReturn($components);87 $components = [];88 // Ensure that inline block components in all sections are returned.89 $inline_component2 = $this->prophesize(SectionComponent::class);90 $inline_plugin2 = $this->prophesize(DerivativeInspectionInterface::class)->willImplement(ConfigurablePluginInterface::class);91 $inline_plugin2->getBaseId()->willReturn('inline_block');92 $inline_plugin2->getConfiguration()->willReturn(['block_revision_id' => 'the_other_revision_id']);93 $inline_component2->getPlugin()->willReturn($inline_plugin2->reveal());94 $inline_component2 = $inline_component2->reveal();95 $components[] = $inline_component2;96 $section2 = $this->prophesize(Section::class);97 $section2->getComponents()->willReturn($components);98 return [99 [100 [$section->reveal(), $section2->reveal()],101 // getInlineBlockComponents() should return inline blocks even if they102 // have no revision Id.103 [104 $inline_component,105 $inline_component_without_revision_id,106 $inline_component2,107 ],108 // getInlineBlockRevisionIdsInSections should just the revision Ids.109 ['the_revision_id', 'the_other_revision_id'],110 ],111 ];112 }113 /**114 * @covers ::getInlineBlockComponents115 *116 * @dataProvider providerSectionsWithInlineComponents117 */118 public function testGetInlineBlockComponents($sections, $expected_components) {119 $test_class = new TestClass();120 $this->assertSame($expected_components, $test_class->getInlineBlockComponents($sections));121 }122 /**123 * @covers ::getInlineBlockRevisionIdsInSections124 *125 * @dataProvider providerSectionsWithInlineComponents126 */127 public function testGetInlineBlockRevisionIdsInSections($sections, $components, $expected_revision_ids) {128 $test_class = new TestClass();129 $this->assertSame($expected_revision_ids, $test_class->getInlineBlockRevisionIdsInSections($sections));130 }131}132/**133 * Test class using the trait.134 */135class TestClass {136 use LayoutEntityHelperTrait {137 isEntityUsingFieldOverride as public;138 getInlineBlockComponents as public;139 getInlineBlockRevisionIdsInSections as public;140 }141}...

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1$testClass = new testClass();2$testClass->testMethod();3$testClass = new testClass();4$testClass->testMethod();5namespace myNamespace;6class testClass {7 public function testMethod() {8 echo "Hello World!";9 }10}11namespace myNamespace;12class testClass {13 public function testMethod() {14 echo "Hello World!";15 }16}17namespace myNamespace;18$testClass = new testClass();19$testClass->testMethod();20namespace myNamespace2;21$testClass = new testClass();22$testClass->testMethod();

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1$obj = new testClass();2$obj->testMethod();3$obj = new testClass();4$obj->testMethod();5$obj = new testClass();6$obj->testMethod();7$obj = new testClass();8$obj->testMethod();9$obj = new testClass();10$obj->testMethod();11$obj = new testClass();12$obj->testMethod();13$obj = new testClass();14$obj->testMethod();15$obj = new testClass();16$obj->testMethod();17$obj = new testClass();18$obj->testMethod();19$obj = new testClass();20$obj->testMethod();21$obj = new testClass();22$obj->testMethod();23$obj = new testClass();24$obj->testMethod();25$obj = new testClass();26$obj->testMethod();27$obj = new testClass();28$obj->testMethod();29$obj = new testClass();30$obj->testMethod();31$obj = new testClass();32$obj->testMethod();33$obj = new testClass();34$obj->testMethod();

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1$obj = new testClass();2$obj->testClassMethod();3$obj = new testClass();4$obj->testClassMethod();5$obj = new testClass();6$obj->testClassMethod();7$obj = new testClass();8$obj->testClassMethod();9$obj = new testClass();10$obj->testClassMethod();11$obj = new testClass();12$obj->testClassMethod();13$obj = new testClass();14$obj->testClassMethod();15$obj = new testClass();16$obj->testClassMethod();17$obj = new testClass();18$obj->testClassMethod();19$obj = new testClass();20$obj->testClassMethod();21$obj = new testClass();22$obj->testClassMethod();23$obj = new testClass();24$obj->testClassMethod();25$obj = new testClass();26$obj->testClassMethod();27$obj = new testClass();28$obj->testClassMethod();29$obj = new testClass();30$obj->testClassMethod();31$obj = new testClass();32$obj->testClassMethod();33$obj = new testClass();34$obj->testClassMethod();

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1$test = new testClass();2$test->testMethod();3$test = new testClass();4$test->testMethod();5$test = new testClass();6$test->testMethod();7$test = new testClass();8$test->testMethod();9$test = new testClass();10$test->testMethod();11$test = new testClass();12$test->testMethod();13$test = new testClass();14$test->testMethod();15$test = new testClass();16$test->testMethod();17$test = new testClass();18$test->testMethod();19$test = new testClass();20$test->testMethod();21$test = new testClass();22$test->testMethod();23$test = new testClass();24$test->testMethod();25$test = new testClass();26$test->testMethod();27$test = new testClass();28$test->testMethod();29$test = new testClass();30$test->testMethod();31$test = new testClass();32$test->testMethod();

Full Screen

Full Screen

testClass

Using AI Code Generation

copy

Full Screen

1$test = new testClass();2$test->testMethod();3$test = new testClass();4$test->testMethod();5$test = new testClass();6$test->testMethod();

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.

Trigger testClass code on LambdaTest Cloud Grid

Execute automation tests with testClass on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

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