comparison core/modules/system/src/Tests/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
3 namespace Drupal\system\Tests\Image; 3 namespace Drupal\system\Tests\Image;
4 4
5 @trigger_error(__FILE__ . ' is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use Drupal\FunctionalTests\Image\ToolkitTestBase instead. See https://www.drupal.org/node/2862641.', E_USER_DEPRECATED); 5 @trigger_error(__FILE__ . ' is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use Drupal\FunctionalTests\Image\ToolkitTestBase instead. See https://www.drupal.org/node/2862641.', E_USER_DEPRECATED);
6 6
7 use Drupal\simpletest\WebTestBase; 7 use Drupal\simpletest\WebTestBase;
8 use Drupal\Component\Utility\SafeMarkup; 8 use Drupal\Component\Render\FormattableMarkup;
9 9
10 /** 10 /**
11 * Base class for image manipulation testing. 11 * Base class for image manipulation testing.
12 * 12 *
13 * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. 13 * @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.
104 $actual = array_keys(array_filter($this->imageTestGetAllCalls())); 104 $actual = array_keys(array_filter($this->imageTestGetAllCalls()));
105 105
106 // Determine if there were any expected that were not called. 106 // Determine if there were any expected that were not called.
107 $uncalled = array_diff($expected, $actual); 107 $uncalled = array_diff($expected, $actual);
108 if (count($uncalled)) { 108 if (count($uncalled)) {
109 $this->assertTrue(FALSE, SafeMarkup::format('Expected operations %expected to be called but %uncalled was not called.', ['%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)])); 109 $this->assertTrue(FALSE, new FormattableMarkup('Expected operations %expected to be called but %uncalled was not called.', ['%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)]));
110 } 110 }
111 else { 111 else {
112 $this->assertTrue(TRUE, SafeMarkup::format('All the expected operations were called: %expected', ['%expected' => implode(', ', $expected)])); 112 $this->assertTrue(TRUE, new FormattableMarkup('All the expected operations were called: %expected', ['%expected' => implode(', ', $expected)]));
113 } 113 }
114 114
115 // Determine if there were any unexpected calls. 115 // Determine if there were any unexpected calls.
116 // If all unexpected calls are operations and apply was expected, we do not 116 // If all unexpected calls are operations and apply was expected, we do not
117 // count it as an error. 117 // count it as an error.
118 $unexpected = array_diff($actual, $expected); 118 $unexpected = array_diff($actual, $expected);
119 if (count($unexpected) && (!in_array('apply', $expected) || count(array_intersect($unexpected, $operations)) !== count($unexpected))) { 119 if (count($unexpected) && (!in_array('apply', $expected) || count(array_intersect($unexpected, $operations)) !== count($unexpected))) {
120 $this->assertTrue(FALSE, SafeMarkup::format('Unexpected operations were called: %unexpected.', ['%unexpected' => implode(', ', $unexpected)])); 120 $this->assertTrue(FALSE, new FormattableMarkup('Unexpected operations were called: %unexpected.', ['%unexpected' => implode(', ', $unexpected)]));
121 } 121 }
122 else { 122 else {
123 $this->assertTrue(TRUE, 'No unexpected operations were called.'); 123 $this->assertTrue(TRUE, 'No unexpected operations were called.');
124 } 124 }
125 } 125 }