Skip to content

Commit

Permalink
MDL-83412 core: Coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Nov 28, 2024
1 parent 7cb2b0c commit 6bd4b3f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion calendar/type/gregorian/classes/structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public function timestamp_to_date_string($time, $format, $timezone, $fixday, $fi
// The documentation for strftime notes that for the "%l" and "%e" specifiers where
// no leading zero is used, a space is used instead.
// As a result we switch to the new format specifiers "%l" and "%e", wrap them in placeholders
// and then remove the spaces
// and then remove the spaces.

if (empty($CFG->nofixday) && $fixday) {
// Config.php can force %d not to be fixed, but only if the format did not specify it.
Expand Down
2 changes: 1 addition & 1 deletion calendar/type/gregorian/tests/structure_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function tearDown(): void {
* Test the timestamp_to_date_string method with different input values.
*
* @dataProvider timestamp_to_date_string_provider
* @param string $lang
* @param string $locale
* @param int $timestamp
* @param string $format
* @param string $timezone
Expand Down
13 changes: 10 additions & 3 deletions lib/tests/classes/mocking_string_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
namespace core\tests;

/**
* A string manager which supports mocking individaul strings.
* A string manager which supports mocking individual strings.
*
* @package core
* @copyright Andrew Lyons <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

class mocking_string_manager extends \core_string_manager_standard {
class mocking_string_manager extends \core_string_manager_standard {
/** @var array<string, string> The list of strings */
private $strings = [];

Expand All @@ -37,6 +36,14 @@ public function get_string($identifier, $component = '', $a = null, $lang = null
return parent::get_string($identifier, $component, $a, $lang);
}

/**
* Mock a string.
*
* @param string $identifier
* @param string $component
* @param string $value
* @return void
*/
public function mock_string(
string $identifier,
string $component,
Expand Down
5 changes: 5 additions & 0 deletions lib/tests/date_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@ public function test_strftime(mixed $input, string $format, string $expected): v
$this->assertEqualsIgnoringWhitespace($expected, core_date::strftime($format, $input));
}

/**
* Data provider for ::test_strftime_locale.
*
* @return array[]
*/
public static function get_strftime_locale_provider(): array {
return [
'Month Year only' => [
Expand Down

0 comments on commit 6bd4b3f

Please sign in to comment.