Skip to content

Commit 339ee1c

Browse files
committed
Fixed Issue #35
1 parent 701b520 commit 339ee1c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/Commands/ShowCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ private function tableRows()
113113
continue;
114114
}
115115

116-
$output[$key]['key'] = $key;
117-
$output[$key][$languageKey] = $value;
116+
if (count($value)) {
117+
$output[$key]['key'] = $key;
118+
$output[$key][$languageKey] = $value;
119+
}
118120
}
119121
}
120122

tests/ShowCommandTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,16 @@ public function testCommandOutputForKeyOnCloseMatch()
128128
$this->assertRegExp('/username(?:.*)uname(?:.*)|(?: *)|/', $this->consoleOutput());
129129
$this->assertNotContains('age', $this->consoleOutput());
130130
}
131+
132+
public function test_ignore_attributes_and_keys_with_empty_arrays()
133+
{
134+
$this->createTempFiles([
135+
'en' => ['user' => "<?php\n return ['name' => 'Name'];"],
136+
'nl' => ['user' => "<?php\n return ['name' => []];"],
137+
]);
138+
139+
$this->artisan('langman:show', ['key' => 'user']);
140+
$this->assertRegExp('/key(?:.*)en(?:.*)nl/', $this->consoleOutput());
141+
$this->assertRegExp('/name(?:.*)Name(?:.*)MISSING/', $this->consoleOutput());
142+
}
131143
}

0 commit comments

Comments
 (0)