diff --git a/modules/simpletest/tests/graph.test b/modules/simpletest/tests/graph.test index c190161..691744e 100644 --- a/modules/simpletest/tests/graph.test +++ b/modules/simpletest/tests/graph.test @@ -69,7 +69,7 @@ class GraphUnitTest extends DrupalUnitTestCase { $this->assertReversePaths($graph, $expected_reverse_paths); // Assert that DFS didn't created "missing" vertexes automatically. - $this->assertFALSE(isset($graph[6]), t('Vertex 6 has not been created')); + $this->assertFALSE(isset($graph[6]), 'Vertex 6 has not been created'); $expected_components = array( array(1, 2, 3, 4, 5, 7), @@ -115,7 +115,7 @@ class GraphUnitTest extends DrupalUnitTestCase { // Build an array with keys = $paths and values = TRUE. $expected = array_fill_keys($paths, TRUE); $result = isset($graph[$vertex]['paths']) ? $graph[$vertex]['paths'] : array(); - $this->assertEqual($expected, $result, t('Expected paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE)))); + $this->assertEqual($expected, $result, format_string('Expected paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE)))); } } @@ -133,7 +133,7 @@ class GraphUnitTest extends DrupalUnitTestCase { // Build an array with keys = $paths and values = TRUE. $expected = array_fill_keys($paths, TRUE); $result = isset($graph[$vertex]['reverse_paths']) ? $graph[$vertex]['reverse_paths'] : array(); - $this->assertEqual($expected, $result, t('Expected reverse paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE)))); + $this->assertEqual($expected, $result, format_string('Expected reverse paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE)))); } } @@ -153,9 +153,9 @@ class GraphUnitTest extends DrupalUnitTestCase { $result_components[] = $graph[$vertex]['component']; unset($unassigned_vertices[$vertex]); } - $this->assertEqual(1, count(array_unique($result_components)), t('Expected one unique component for vertices @vertices, got @components', array('@vertices' => $this->displayArray($component), '@components' => $this->displayArray($result_components)))); + $this->assertEqual(1, count(array_unique($result_components)), format_string('Expected one unique component for vertices @vertices, got @components', array('@vertices' => $this->displayArray($component), '@components' => $this->displayArray($result_components)))); } - $this->assertEqual(array(), $unassigned_vertices, t('Vertices not assigned to a component: @vertices', array('@vertices' => $this->displayArray($unassigned_vertices, TRUE)))); + $this->assertEqual(array(), $unassigned_vertices, format_string('Vertices not assigned to a component: @vertices', array('@vertices' => $this->displayArray($unassigned_vertices, TRUE)))); } /** @@ -170,7 +170,7 @@ class GraphUnitTest extends DrupalUnitTestCase { foreach ($expected_orders as $order) { $previous_vertex = array_shift($order); foreach ($order as $vertex) { - $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], t('Weights of @previous-vertex and @vertex are correct relative to each other', array('@previous-vertex' => $previous_vertex, '@vertex' => $vertex))); + $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], format_string('Weights of @previous-vertex and @vertex are correct relative to each other', array('@previous-vertex' => $previous_vertex, '@vertex' => $vertex))); } } } diff --git a/modules/simpletest/tests/image.test b/modules/simpletest/tests/image.test index 403c9d7..dc95a6e 100644 --- a/modules/simpletest/tests/image.test +++ b/modules/simpletest/tests/image.test @@ -55,19 +55,19 @@ class ImageToolkitTestCase extends DrupalWebTestCase { // Determine if there were any expected that were not called. $uncalled = array_diff($expected, $actual); if (count($uncalled)) { - $this->assertTrue(FALSE, t('Expected operations %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)))); + $this->assertTrue(FALSE, format_string('Expected operations %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled)))); } else { - $this->assertTrue(TRUE, t('All the expected operations were called: %expected', array('%expected' => implode(', ', $expected)))); + $this->assertTrue(TRUE, format_string('All the expected operations were called: %expected', array('%expected' => implode(', ', $expected)))); } // Determine if there were any unexpected calls. $unexpected = array_diff($actual, $expected); if (count($unexpected)) { - $this->assertTrue(FALSE, t('Unexpected operations were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected)))); + $this->assertTrue(FALSE, format_string('Unexpected operations were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected)))); } else { - $this->assertTrue(TRUE, t('No unexpected operations were called.')); + $this->assertTrue(TRUE, 'No unexpected operations were called.'); } } } @@ -90,8 +90,8 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase { */ function testGetAvailableToolkits() { $toolkits = image_get_available_toolkits(); - $this->assertTrue(isset($toolkits['test']), t('The working toolkit was returned.')); - $this->assertFalse(isset($toolkits['broken']), t('The toolkit marked unavailable was not returned')); + $this->assertTrue(isset($toolkits['test']), 'The working toolkit was returned.'); + $this->assertFalse(isset($toolkits['broken']), 'The toolkit marked unavailable was not returned'); $this->assertToolkitOperationsCalled(array()); } @@ -100,8 +100,8 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase { */ function testLoad() { $image = image_load($this->file, $this->toolkit); - $this->assertTrue(is_object($image), t('Returned an object.')); - $this->assertEqual($this->toolkit, $image->toolkit, t('Image had toolkit set.')); + $this->assertTrue(is_object($image), 'Returned an object.'); + $this->assertEqual($this->toolkit, $image->toolkit, 'Image had toolkit set.'); $this->assertToolkitOperationsCalled(array('load', 'get_info')); } @@ -109,7 +109,7 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase { * Test the image_save() function. */ function testSave() { - $this->assertFalse(image_save($this->image), t('Function returned the expected value.')); + $this->assertFalse(image_save($this->image), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('save')); } @@ -117,13 +117,13 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase { * Test the image_resize() function. */ function testResize() { - $this->assertTrue(image_resize($this->image, 1, 2), t('Function returned the expected value.')); + $this->assertTrue(image_resize($this->image, 1, 2), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('resize')); // Check the parameters. $calls = image_test_get_all_calls(); - $this->assertEqual($calls['resize'][0][1], 1, t('Width was passed correctly')); - $this->assertEqual($calls['resize'][0][2], 2, t('Height was passed correctly')); + $this->assertEqual($calls['resize'][0][1], 1, 'Width was passed correctly'); + $this->assertEqual($calls['resize'][0][2], 2, 'Height was passed correctly'); } /** @@ -131,69 +131,69 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase { */ function testScale() { // TODO: need to test upscaling - $this->assertTrue(image_scale($this->image, 10, 10), t('Function returned the expected value.')); + $this->assertTrue(image_scale($this->image, 10, 10), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('resize')); // Check the parameters. $calls = image_test_get_all_calls(); - $this->assertEqual($calls['resize'][0][1], 10, t('Width was passed correctly')); - $this->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly')); + $this->assertEqual($calls['resize'][0][1], 10, 'Width was passed correctly'); + $this->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly'); } /** * Test the image_scale_and_crop() function. */ function testScaleAndCrop() { - $this->assertTrue(image_scale_and_crop($this->image, 5, 10), t('Function returned the expected value.')); + $this->assertTrue(image_scale_and_crop($this->image, 5, 10), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('resize', 'crop')); // Check the parameters. $calls = image_test_get_all_calls(); - $this->assertEqual($calls['crop'][0][1], 7.5, t('X was computed and passed correctly')); - $this->assertEqual($calls['crop'][0][2], 0, t('Y was computed and passed correctly')); - $this->assertEqual($calls['crop'][0][3], 5, t('Width was computed and passed correctly')); - $this->assertEqual($calls['crop'][0][4], 10, t('Height was computed and passed correctly')); + $this->assertEqual($calls['crop'][0][1], 7.5, 'X was computed and passed correctly'); + $this->assertEqual($calls['crop'][0][2], 0, 'Y was computed and passed correctly'); + $this->assertEqual($calls['crop'][0][3], 5, 'Width was computed and passed correctly'); + $this->assertEqual($calls['crop'][0][4], 10, 'Height was computed and passed correctly'); } /** * Test the image_rotate() function. */ function testRotate() { - $this->assertTrue(image_rotate($this->image, 90, 1), t('Function returned the expected value.')); + $this->assertTrue(image_rotate($this->image, 90, 1), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('rotate')); // Check the parameters. $calls = image_test_get_all_calls(); - $this->assertEqual($calls['rotate'][0][1], 90, t('Degrees were passed correctly')); - $this->assertEqual($calls['rotate'][0][2], 1, t('Background color was passed correctly')); + $this->assertEqual($calls['rotate'][0][1], 90, 'Degrees were passed correctly'); + $this->assertEqual($calls['rotate'][0][2], 1, 'Background color was passed correctly'); } /** * Test the image_crop() function. */ function testCrop() { - $this->assertTrue(image_crop($this->image, 1, 2, 3, 4), t('Function returned the expected value.')); + $this->assertTrue(image_crop($this->image, 1, 2, 3, 4), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('crop')); // Check the parameters. $calls = image_test_get_all_calls(); - $this->assertEqual($calls['crop'][0][1], 1, t('X was passed correctly')); - $this->assertEqual($calls['crop'][0][2], 2, t('Y was passed correctly')); - $this->assertEqual($calls['crop'][0][3], 3, t('Width was passed correctly')); - $this->assertEqual($calls['crop'][0][4], 4, t('Height was passed correctly')); + $this->assertEqual($calls['crop'][0][1], 1, 'X was passed correctly'); + $this->assertEqual($calls['crop'][0][2], 2, 'Y was passed correctly'); + $this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly'); + $this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly'); } /** * Test the image_desaturate() function. */ function testDesaturate() { - $this->assertTrue(image_desaturate($this->image), t('Function returned the expected value.')); + $this->assertTrue(image_desaturate($this->image), 'Function returned the expected value.'); $this->assertToolkitOperationsCalled(array('desaturate')); // Check the parameters. $calls = image_test_get_all_calls(); - $this->assertEqual(count($calls['desaturate'][0]), 1, t('Only the image was passed.')); + $this->assertEqual(count($calls['desaturate'][0]), 1, 'Only the image was passed.'); } } @@ -453,11 +453,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase { file_prepare_directory($directory, FILE_CREATE_DIRECTORY); image_save($image, $directory . '/' . $op . '.' . $image->info['extension']); - $this->assertTrue($correct_dimensions_real, t('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op))); - $this->assertTrue($correct_dimensions_object, t('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op))); + $this->assertTrue($correct_dimensions_real, format_string('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op))); + $this->assertTrue($correct_dimensions_object, format_string('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op))); // JPEG colors will always be messed up due to compression. if ($image->info['extension'] != 'jpg') { - $this->assertTrue($correct_colors, t('Image %file object after %action action has the correct color placement.', array('%file' => $file, '%action' => $op))); + $this->assertTrue($correct_colors, format_string('Image %file object after %action action has the correct color placement.', array('%file' => $file, '%action' => $op))); } } } diff --git a/modules/simpletest/tests/lock.test b/modules/simpletest/tests/lock.test index 0b423ff..797befc 100644 --- a/modules/simpletest/tests/lock.test +++ b/modules/simpletest/tests/lock.test @@ -23,35 +23,35 @@ class LockFunctionalTest extends DrupalWebTestCase { function testLockAcquire() { $lock_acquired = 'TRUE: Lock successfully acquired in system_test_lock_acquire()'; $lock_not_acquired = 'FALSE: Lock not acquired in system_test_lock_acquire()'; - $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock')); - $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock extended by this request.'), t('Lock')); + $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock'); + $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock extended by this request.', 'Lock'); lock_release('system_test_lock_acquire'); // Cause another request to acquire the lock. $this->drupalGet('system-test/lock-acquire'); - $this->assertText($lock_acquired, t('Lock acquired by the other request.'), t('Lock')); + $this->assertText($lock_acquired, 'Lock acquired by the other request.', 'Lock'); // The other request has finished, thus it should have released its lock. - $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock')); + $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock'); // This request holds the lock, so the other request cannot acquire it. $this->drupalGet('system-test/lock-acquire'); - $this->assertText($lock_not_acquired, t('Lock not acquired by the other request.'), t('Lock')); + $this->assertText($lock_not_acquired, 'Lock not acquired by the other request.', 'Lock'); lock_release('system_test_lock_acquire'); // Try a very short timeout and lock breaking. - $this->assertTrue(lock_acquire('system_test_lock_acquire', 0.5), t('Lock acquired by this request.'), t('Lock')); + $this->assertTrue(lock_acquire('system_test_lock_acquire', 0.5), 'Lock acquired by this request.', 'Lock'); sleep(1); // The other request should break our lock. $this->drupalGet('system-test/lock-acquire'); - $this->assertText($lock_acquired, t('Lock acquired by the other request, breaking our lock.'), t('Lock')); + $this->assertText($lock_acquired, 'Lock acquired by the other request, breaking our lock.', 'Lock'); // We cannot renew it, since the other thread took it. - $this->assertFalse(lock_acquire('system_test_lock_acquire'), t('Lock cannot be extended by this request.'), t('Lock')); + $this->assertFalse(lock_acquire('system_test_lock_acquire'), 'Lock cannot be extended by this request.', 'Lock'); // Check the shut-down function. $lock_acquired_exit = 'TRUE: Lock successfully acquired in system_test_lock_exit()'; $lock_not_acquired_exit = 'FALSE: Lock not acquired in system_test_lock_exit()'; $this->drupalGet('system-test/lock-exit'); - $this->assertText($lock_acquired_exit, t('Lock acquired by the other request before exit.'), t('Lock')); - $this->assertTrue(lock_acquire('system_test_lock_exit'), t('Lock acquired by this request after the other request exits.'), t('Lock')); + $this->assertText($lock_acquired_exit, 'Lock acquired by the other request before exit.', 'Lock'); + $this->assertTrue(lock_acquire('system_test_lock_exit'), 'Lock acquired by this request after the other request exits.', 'Lock'); } }