Skip to content

Commit bba9fe7

Browse files
committed
AC-13231: Magento option --magento-init-params never used when running cli?
Removed try catch block
1 parent b734090 commit bba9fe7

File tree

1 file changed

+37
-43
lines changed

1 file changed

+37
-43
lines changed

dev/tests/integration/testsuite/Magento/Framework/Console/CliStateTest.php

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,15 @@ public function testStateGetModeWithMagentoInitParams(string $mode)
6767
];
6868
$_SERVER['argv'] = $testArgv;
6969

70-
try {
71-
// Get the State object from the ObjectManager
72-
$state = $this->getObjectManager()->get(State::class);
73-
74-
// Assert that State::getMode() returns the correct mode
75-
$this->assertEquals(
76-
$mode,
77-
$state->getMode(),
78-
'State::getMode() should return "' . $mode . '" when MAGE_MODE set via --magento-init-params'
79-
);
80-
} catch (\Exception $e) {
81-
}
70+
// Get the State object from the ObjectManager
71+
$state = $this->getObjectManager()->get(State::class);
72+
73+
// Assert that State::getMode() returns the correct mode
74+
$this->assertEquals(
75+
$mode,
76+
$state->getMode(),
77+
'State::getMode() should return "' . $mode . '" when MAGE_MODE set via --magento-init-params'
78+
);
8279
}
8380

8481
/**
@@ -102,37 +99,34 @@ public function testMultipleMagentoInitParams()
10299
];
103100
$_SERVER['argv'] = $testArgv;
104101

105-
try {
106-
// Get the ObjectManager
107-
$objectManager = $this->getObjectManager();
108-
109-
// Get the State object from the ObjectManager
110-
$state = $objectManager->get(State::class);
111-
112-
// Assert that State::getMode() returns the correct mode
113-
$this->assertEquals(
114-
$mode,
115-
$state->getMode(),
116-
'State::getMode() should return "' . $mode . '" when MAGE_MODE set via --magento-init-params'
117-
);
118-
119-
// Get the DirectoryList to verify filesystem paths were set
120-
$directoryList = $objectManager->get(DirectoryList::class);
121-
122-
// Assert that custom filesystem paths were applied
123-
$this->assertEquals(
124-
$cachePath,
125-
$directoryList->getPath(DirectoryList::CACHE),
126-
'Custom cache directory path should be set via --magento-init-params'
127-
);
128-
129-
$this->assertEquals(
130-
$varPath,
131-
$directoryList->getPath(DirectoryList::VAR_DIR),
132-
'Custom var directory path should be set via --magento-init-params'
133-
);
134-
} catch (\Exception $e) {
135-
}
102+
// Get the ObjectManager
103+
$objectManager = $this->getObjectManager();
104+
105+
// Get the State object from the ObjectManager
106+
$state = $objectManager->get(State::class);
107+
108+
// Assert that State::getMode() returns the correct mode
109+
$this->assertEquals(
110+
$mode,
111+
$state->getMode(),
112+
'State::getMode() should return "' . $mode . '" when MAGE_MODE set via --magento-init-params'
113+
);
114+
115+
// Get the DirectoryList to verify filesystem paths were set
116+
$directoryList = $objectManager->get(DirectoryList::class);
117+
118+
// Assert that custom filesystem paths were applied
119+
$this->assertEquals(
120+
$cachePath,
121+
$directoryList->getPath(DirectoryList::CACHE),
122+
'Custom cache directory path should be set via --magento-init-params'
123+
);
124+
125+
$this->assertEquals(
126+
$varPath,
127+
$directoryList->getPath(DirectoryList::VAR_DIR),
128+
'Custom var directory path should be set via --magento-init-params'
129+
);
136130
}
137131

138132
/**

0 commit comments

Comments
 (0)