Skip to content

Commit 0665f5a

Browse files
committed
MQE-434: Create operation api unit tests
- fix static code sniff failures - add static checks for unit and verification test
1 parent 76f9cdc commit 0665f5a

9 files changed

+17
-17
lines changed

bin/static-checks

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
echo "===============================PHP CODE SNIFFER REPORT==============================="
55
vendor/bin/phpcs ./src --standard=./dev/tests/static/Magento
6+
vendor/bin/phpcs ./dev/tests/unit --standard=./dev/tests/static/Magento
7+
vendor/bin/phpcs ./dev/tests/verification --standard=./dev/tests/static/Magento
68

79
echo "===============================COPY PASTE DETECTOR REPORT==============================="
810
vendor/bin/phpcpd ./src

dev/tests/unit/Magento/FunctionalTestFramework/Page/Objects/SectionObjectTest.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class SectionObjectTest extends TestCase
1818
/**
1919
* Assert that the section object has an element
2020
*/
21-
public function testHasElement() {
21+
public function testHasElement()
22+
{
2223
$element1 = new ElementObject('element1', 'type', '#selector', null, '41', false);
2324
$element2 = new ElementObject('element2', 'type', '#selector', null, '42', true);
2425
$elements = [
@@ -32,7 +33,8 @@ public function testHasElement() {
3233
/**
3334
* Assert that the section object doesn't have an element
3435
*/
35-
public function testDoesntHaveElement() {
36+
public function testDoesntHaveElement()
37+
{
3638
$element2 = new ElementObject('element2', 'type', '#selector', null, '42', true);
3739
$elements = [
3840
'element2' => $element2
@@ -44,7 +46,8 @@ public function testDoesntHaveElement() {
4446
/**
4547
* Assert that an element object is returned
4648
*/
47-
public function testGetElement() {
49+
public function testGetElement()
50+
{
4851
$element1 = new ElementObject('element1', 'type', '#selector', null, '41', false);
4952
$element2 = new ElementObject('element2', 'type', '#selector', null, '42', true);
5053
$elements = [
@@ -60,7 +63,8 @@ public function testGetElement() {
6063
/**
6164
* Assert that null is returned if no such element
6265
*/
63-
public function testNullGetElement() {
66+
public function testNullGetElement()
67+
{
6468
$element1 = new ElementObject('element1', 'type', '#selector', null, '41', false);
6569
$elements = [
6670
'element1' => $element1

dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionMergeUtilTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ public function testResolveActionStepEntityData()
130130
$actionName = "myAction";
131131
$actionType = "myCustomType";
132132

133-
134133
// Set up mock data object
135134
$mockData = [$dataFieldName => $dataFieldValue];
136135
$mockDataObject = new EntityDataObject($dataObjectName, $dataObjectType, $mockData, null, null, null);

dev/tests/unit/Util/EntityDataObjectBuilder.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,4 @@ public function withLinkedEntities($linkedEntities)
113113
$this->linkedEntities = $linkedEntities;
114114
return $this;
115115
}
116-
117-
}
116+
}

dev/tests/unit/Util/OperationDefinitionBuilder.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ public function withMetadata($metadata)
112112
}
113113
}
114114

115-
$this->metadata = array_merge($this->metadata, OperationElementBuilder::buildOperationElementFields($primitives));
115+
$this->metadata = array_merge(
116+
$this->metadata,
117+
OperationElementBuilder::buildOperationElementFields($primitives)
118+
);
116119
return $this;
117120
}
118-
119-
120-
}
121+
}

dev/tests/unit/Util/OperationElementBuilder.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class OperationElementBuilder
6161
*/
6262
private $nestedElements;
6363

64-
6564
/**
6665
* Build function which takes params defined by the user and returns a new Operation Element.
6766
*
@@ -189,4 +188,4 @@ public static function buildOperationElementFields($fields)
189188

190189
return $operationElements;
191190
}
192-
}
191+
}

dev/tests/verification/Tests/ActionGroupMergeGenerationTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function testActionGroupFunctionalCest()
3232
$this->runComparisonTest(self::ACTION_GROUP_FUNCTIONAL_CEST);
3333
}
3434

35-
3635
/**
3736
* Generate a Cest by name and assert that it equals the corresponding .txt source of truth
3837
*
@@ -51,7 +50,6 @@ private function runComparisonTest($cestName)
5150

5251
$this->assertTrue(file_exists($cestFile));
5352

54-
5553
$this->assertFileEquals(
5654
self::RESOURCES_PATH . DIRECTORY_SEPARATOR . $cestName . ".txt",
5755
$cestFile

dev/tests/verification/Tests/ReferenceReplacementGenerationTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ private function runComparisonTest($cestName)
6767

6868
$this->assertTrue(file_exists($cestFile));
6969

70-
7170
$this->assertFileEquals(
7271
self::RESOURCES_PATH . DIRECTORY_SEPARATOR . $cestName . ".txt",
7372
$cestFile

dev/tests/verification/Tests/SuiteGenerationTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class SuiteGenerationTest extends TestCase
1919
private static $YML_EXISTS_FLAG = false;
2020
private static $TEST_GROUPS = [];
2121

22-
2322
public static function setUpBeforeClass()
2423
{
2524
if (file_exists(self::CONFIG_YML_FILE)) {

0 commit comments

Comments
 (0)