Skip to content

Commit 49336cc

Browse files
authored
Merge pull request #2497 from magento-borg/DEVOPS-2174-2.1
Fixed issues: - DEVOPS-232 Static Testing in Jenkins
2 parents f520001 + 83dcdc3 commit 49336cc

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,13 @@ protected function _applyOneFixture($fixture)
171171
require $fixture;
172172
}
173173
} catch (\Exception $e) {
174-
throw new \Exception(
175-
sprintf("Error in fixture: %s.\n %s", json_encode($fixture), $e->getMessage()),
174+
throw new \PHPUnit_Framework_Exception(
175+
sprintf(
176+
"Error in fixture: %s.\n %s\n %s",
177+
json_encode($fixture),
178+
$e->getMessage(),
179+
$e->getTraceAsString()
180+
),
176181
500,
177182
$e
178183
);

dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixtureBeforeTransaction.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,15 @@ protected function _applyOneFixture($fixture)
138138
require $fixture;
139139
}
140140
} catch (\Exception $e) {
141-
throw new \Exception(
142-
sprintf("Error in fixture: %s.\n %s", json_encode($fixture), (string)$e)
141+
throw new \PHPUnit_Framework_Exception(
142+
sprintf(
143+
"Error in fixture: %s.\n %s\n %s",
144+
json_encode($fixture),
145+
$e->getMessage(),
146+
$e->getTraceAsString()
147+
),
148+
500,
149+
$e
143150
);
144151
}
145152
}

dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class GroupManagementTest extends \PHPUnit_Framework_TestCase
1616
{
1717
/**
18-
* @var \Magento\Framework\ObjectManagerInterface
18+
* @var \Magento\TestFramework\ObjectManager
1919
*/
2020
protected $objectManager;
2121

@@ -42,21 +42,21 @@ public function testGetDefaultGroupWithStoreId($testGroup, $storeId)
4242
}
4343

4444
/**
45-
* @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php
45+
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
4646
*/
4747
public function testGetDefaultGroupWithNonDefaultStoreId()
4848
{
4949
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
5050
$storeManager = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface');
51-
$nonDefaultStore = $storeManager->getStore('secondstore');
51+
$nonDefaultStore = $storeManager->getStore('fixturestore');
5252
$nonDefaultStoreId = $nonDefaultStore->getId();
5353
/** @var \Magento\Framework\App\MutableScopeConfig $scopeConfig */
5454
$scopeConfig = $this->objectManager->get('Magento\Framework\App\MutableScopeConfig');
5555
$scopeConfig->setValue(
5656
\Magento\Customer\Model\GroupManagement::XML_PATH_DEFAULT_ID,
5757
2,
5858
ScopeInterface::SCOPE_STORE,
59-
'secondstore'
59+
'fixturestore'
6060
);
6161
$testGroup = ['id' => 2, 'code' => 'Wholesale', 'tax_class_id' => 3, 'tax_class_name' => 'Retail Customer'];
6262
$this->assertDefaultGroupMatches($testGroup, $nonDefaultStoreId);

dev/tests/integration/testsuite/Magento/Framework/TranslateCachingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testLoadDataCaching()
4848
/** @var \Magento\Framework\Translate $model */
4949
$model = $this->objectManager->get('Magento\Framework\Translate');
5050

51-
$model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND); // this is supposed to cache the fixture
51+
$model->loadData(\Magento\Framework\App\Area::AREA_FRONTEND, true); // this is supposed to cache the fixture
5252
$this->assertEquals('Fixture Db Translation', new Phrase('Fixture String'));
5353

5454
/** @var \Magento\Translation\Model\ResourceModel\StringUtils $translateString */

dev/tests/static/testsuite/Magento/Test/Less/LiveCodeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function setUpBeforeClass()
4343
*/
4444
public function testCodeStyle()
4545
{
46-
$reportFile = self::$reportDir . '/less_report.txt';
46+
$reportFile = self::$reportDir . '/csless_report.txt';
4747
$wrapper = new LessWrapper();
4848
$codeSniffer = new CodeSniffer(realpath(__DIR__ . '/_files/lesscs'), $reportFile, $wrapper);
4949

@@ -57,10 +57,11 @@ public function testCodeStyle()
5757

5858
$result = $codeSniffer->run($this->filterFiles($fileList));
5959

60+
$report = file_exists($reportFile) ? file_get_contents($reportFile) : "";
6061
$this->assertEquals(
6162
0,
6263
$result,
63-
"PHP Code Sniffer has found {$result} error(s): See detailed report in {$reportFile}"
64+
"PHP Code Sniffer has found {$result} error(s): " . PHP_EOL . $report
6465
);
6566
}
6667

0 commit comments

Comments
 (0)