Mercurial > hg > isophonics-drupal-site
comparison core/tests/Drupal/FunctionalTests/Image/ToolkitTestBase.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\FunctionalTests\Image; | 3 namespace Drupal\FunctionalTests\Image; |
4 | 4 |
5 use Drupal\Component\Utility\SafeMarkup; | 5 use Drupal\Component\Render\FormattableMarkup; |
6 use Drupal\Tests\BrowserTestBase; | 6 use Drupal\Tests\BrowserTestBase; |
7 use Drupal\Tests\TestFileCreationTrait; | 7 use Drupal\Tests\TestFileCreationTrait; |
8 | 8 |
9 /** | 9 /** |
10 * Base class for image manipulation testing. | 10 * Base class for image manipulation testing. |
101 $actual = array_keys(array_filter($this->imageTestGetAllCalls())); | 101 $actual = array_keys(array_filter($this->imageTestGetAllCalls())); |
102 | 102 |
103 // Determine if there were any expected that were not called. | 103 // Determine if there were any expected that were not called. |
104 $uncalled = array_diff($expected, $actual); | 104 $uncalled = array_diff($expected, $actual); |
105 if (count($uncalled)) { | 105 if (count($uncalled)) { |
106 $this->assertTrue(FALSE, SafeMarkup::format('Expected operations %expected to be called but %uncalled was not called.', ['%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)])); | 106 $this->assertTrue(FALSE, new FormattableMarkup('Expected operations %expected to be called but %uncalled was not called.', ['%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)])); |
107 } | 107 } |
108 else { | 108 else { |
109 $this->assertTrue(TRUE, SafeMarkup::format('All the expected operations were called: %expected', ['%expected' => implode(', ', $expected)])); | 109 $this->assertTrue(TRUE, new FormattableMarkup('All the expected operations were called: %expected', ['%expected' => implode(', ', $expected)])); |
110 } | 110 } |
111 | 111 |
112 // Determine if there were any unexpected calls. | 112 // Determine if there were any unexpected calls. |
113 // If all unexpected calls are operations and apply was expected, we do not | 113 // If all unexpected calls are operations and apply was expected, we do not |
114 // count it as an error. | 114 // count it as an error. |
115 $unexpected = array_diff($actual, $expected); | 115 $unexpected = array_diff($actual, $expected); |
116 if (count($unexpected) && (!in_array('apply', $expected) || count(array_intersect($unexpected, $operations)) !== count($unexpected))) { | 116 if (count($unexpected) && (!in_array('apply', $expected) || count(array_intersect($unexpected, $operations)) !== count($unexpected))) { |
117 $this->assertTrue(FALSE, SafeMarkup::format('Unexpected operations were called: %unexpected.', ['%unexpected' => implode(', ', $unexpected)])); | 117 $this->assertTrue(FALSE, new FormattableMarkup('Unexpected operations were called: %unexpected.', ['%unexpected' => implode(', ', $unexpected)])); |
118 } | 118 } |
119 else { | 119 else { |
120 $this->assertTrue(TRUE, 'No unexpected operations were called.'); | 120 $this->assertTrue(TRUE, 'No unexpected operations were called.'); |
121 } | 121 } |
122 } | 122 } |