Unverified Commit 856b81f0 authored by larowlan's avatar larowlan

Issue #3161300 by jungle, TR, Hardik_Patel_12, Chris Burge, longwave, Kristen...

Issue #3161300 by jungle, TR, Hardik_Patel_12, Chris Burge, longwave, Kristen Pol: Improve test coverage of \Drupal\Tests\layout_builder\Unit\SectionTest::testUnsetThirdPartySetting()

(cherry picked from commit 84bae9da)
parent 713b4933
...@@ -314,42 +314,42 @@ public function providerTestSetThirdPartySetting() { ...@@ -314,42 +314,42 @@ public function providerTestSetThirdPartySetting() {
* @covers ::unsetThirdPartySetting * @covers ::unsetThirdPartySetting
* @dataProvider providerTestUnsetThirdPartySetting * @dataProvider providerTestUnsetThirdPartySetting
*/ */
public function testUnsetThirdPartySetting() { public function testUnsetThirdPartySetting($provider, $key, $expected) {
$this->section->unsetThirdPartySetting('bad_judgement', 'blink_speed'); $this->section->unsetThirdPartySetting($provider, $key);
$this->assertSame(['spin_direction' => 'clockwise'], $this->section->getThirdPartySettings('bad_judgement')); $this->assertSame($expected, $this->section->getThirdPartySettings($provider));
$this->section->unsetThirdPartySetting('hunt_and_peck', 'delay');
$this->assertSame([], $this->section->getThirdPartySettings('hunt_and_peck'));
$this->section->unsetThirdPartySetting('bad_judgement', 'non_existing_key');
$this->section->unsetThirdPartySetting('non_existing_provider', 'non_existing_key');
} }
/** /**
* Provides test data for ::testUnsetThirdPartySettings(). * Provides test data for ::testUnsetThirdPartySetting().
*/ */
public function providerTestUnsetThirdPartySetting() { public function providerTestUnsetThirdPartySetting() {
$data = []; $data = [];
$data[] = [ $data['Key with values'] = [
'bad_judgement', 'bad_judgement',
'blink_speed', 'blink_speed',
[ [
'spin_direction' => 'clockwise', 'spin_direction' => 'clockwise',
], ],
]; ];
$data[] = [ $data['Key without values'] = [
'hunt_and_peck', 'hunt_and_peck',
'delay', 'delay',
[], [],
]; ];
$data[] = [ $data['Non-existing key'] = [
'bad_judgement', 'bad_judgement',
'non_existing_key', 'non_existing_key',
[], [
'blink_speed' => 'fast',
'spin_direction' => 'clockwise',
],
]; ];
$data[] = [ $data['Non-existing provider'] = [
'non_existing_provider', 'non_existing_provider',
'non_existing_key', 'non_existing_key',
[], [],
]; ];
return $data; return $data;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment