|
2 | 2 |
|
3 | 3 | namespace Tests\UpdateScripts; |
4 | 4 |
|
5 | | -use Illuminate\Support\Carbon; |
6 | 5 | use PHPUnit\Framework\Attributes\DataProvider; |
7 | 6 | use PHPUnit\Framework\Attributes\Test; |
8 | | -use ReflectionClass; |
9 | 7 | use Statamic\Facades\Blueprint; |
10 | 8 | use Statamic\Facades\Collection; |
11 | 9 | use Statamic\Facades\Entry; |
12 | 10 | use Statamic\Facades\Fieldset; |
13 | 11 | use Statamic\Facades\GlobalSet; |
14 | | -use Statamic\Facades\Stache; |
15 | 12 | use Statamic\Facades\Taxonomy; |
16 | 13 | use Statamic\Facades\Term; |
17 | 14 | use Statamic\Facades\User; |
@@ -71,24 +68,11 @@ public function it_converts_entry_date_field_in_entries() |
71 | 68 | ], |
72 | 69 | ])->save(); |
73 | 70 |
|
74 | | - // We want to set the time to 12pm in America/New_York, which is 5pm in UTC. |
75 | | - // Since Entry::date() automatically converts the value to UTC, we need to set it directly. |
76 | | - // It's naughty, but it's the only way I could find to set the "old" value. |
77 | | - $entry = Entry::make()->id('foo')->collection('articles'); |
78 | | - |
79 | | - $reflection = new ReflectionClass($entry); |
80 | | - $property = $reflection->getProperty('date'); |
81 | | - $property->setAccessible(true); |
82 | | - $property->setValue($entry, Carbon::parse('2025-01-01 12:00', 'America/New_York')); |
83 | | - |
| 71 | + $entry = Entry::make()->id('foo')->collection('articles')->date('2025-01-01-1200'); |
84 | 72 | $entry->save(); |
85 | 73 |
|
86 | 74 | $this->runUpdateScript(ConvertDatesToUtc::class); |
87 | 75 |
|
88 | | - // We're clearing the Stache here to ensure the Carbon instance above doesn't end |
89 | | - // up being the same one we're testing against below. |
90 | | - Stache::clear(); |
91 | | - |
92 | 76 | $entry = Entry::find($entry->id()); |
93 | 77 |
|
94 | 78 | $this->assertEquals('2025-01-01 17:00', $entry->date()->format('Y-m-d H:i')); |
|
0 commit comments