@@ 57-73 (lines=17) @@ | ||
54 | * @param $translationKey |
|
55 | * @param string $message |
|
56 | */ |
|
57 | private function translationExists(SourceCollection $sc, $translationKey, $message = null) |
|
58 | { |
|
59 | if (empty($message)) { |
|
60 | $message = sprintf('Tried to find "%s" but failed', $translationKey); |
|
61 | } |
|
62 | ||
63 | $found = false; |
|
64 | foreach ($sc as $source) { |
|
65 | if ($translationKey === $source->getMessage()) { |
|
66 | $found = true; |
|
67 | ||
68 | break; |
|
69 | } |
|
70 | } |
|
71 | ||
72 | $this->assertTrue($found, $message); |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Assert that a translation key is missing in source collection. |
|
@@ 82-98 (lines=17) @@ | ||
79 | * @param $translationKey |
|
80 | * @param string $message |
|
81 | */ |
|
82 | private function translationMissing(SourceCollection $sc, $translationKey, $message = null) |
|
83 | { |
|
84 | if (empty($message)) { |
|
85 | $message = sprintf('The translation key "%s" should not exist', $translationKey); |
|
86 | } |
|
87 | ||
88 | $found = false; |
|
89 | foreach ($sc as $source) { |
|
90 | if ($translationKey === $source->getMessage()) { |
|
91 | $found = true; |
|
92 | ||
93 | break; |
|
94 | } |
|
95 | } |
|
96 | ||
97 | $this->assertFalse($found, $message); |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * @return PHPFileExtractor |