|
3 | 3 | use App\Models\Blog; |
4 | 4 | use App\Models\Node; |
5 | 5 | use App\Models\Notice; |
| 6 | +use App\Models\Resource; |
6 | 7 | use App\Models\Subject; |
7 | 8 | use App\Models\User; |
8 | 9 | use Illuminate\Support\Facades\Cache; |
|
93 | 94 | 'resource_type' => 'video', |
94 | 95 | 'title' => 'Matrix o nirnayok 01', |
95 | 96 | 'status' => 'approved', |
| 97 | + 'thumbnail' => 'https://img.youtube.com/vi/dQw4w9WgXcQ/hqdefault.jpg', |
96 | 98 | 'items' => [ |
97 | 99 | ['format' => 'video', 'title' => 'Matrix o nirnayok 01', 'source' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'], |
98 | 100 | ], |
|
111 | 113 | $appName = config('app.name', 'HSCStack'); |
112 | 114 | $response->assertSee("Matrix o nirnayok 01 - HSC - Higher Mathematics - {$appName}", false); |
113 | 115 | $response->assertSee('Study material: Matrix o nirnayok 01 (video) for HSC - Higher Mathematics on HSCStack.', false); |
| 116 | + $response->assertSee('<meta property="og:image" content="https://img.youtube.com/vi/dQw4w9WgXcQ/hqdefault.jpg">', false); |
| 117 | + $response->assertSee('<meta property="og:type" content="video.other">', false); |
114 | 118 |
|
115 | 119 | // Ensure subsequent cache-hit request works properly without incomplete class errors |
116 | 120 | $cachedResponse = $this->get("/resources/{$resource->id}"); |
117 | 121 | $cachedResponse->assertStatus(200); |
| 122 | + |
| 123 | + // Verify resource with custom thumbnail |
| 124 | + $thumbResource = App\Models\Resource::create([ |
| 125 | + 'node_id' => $node->id, |
| 126 | + 'resource_type' => 'note', |
| 127 | + 'title' => 'Calculus Formula Sheet', |
| 128 | + 'status' => 'approved', |
| 129 | + 'thumbnail' => 'https://cdn.hscstack.site/thumbnails/calc.png', |
| 130 | + 'items' => [ |
| 131 | + ['format' => 'pdf', 'title' => 'Calculus PDF', 'source' => 'https://cdn.hscstack.site/docs/calc.pdf'], |
| 132 | + ], |
| 133 | + ]); |
| 134 | + |
| 135 | + $thumbResponse = $this->get("/resources/{$thumbResource->id}"); |
| 136 | + $thumbResponse->assertStatus(200); |
| 137 | + $thumbResponse->assertSee('<meta property="og:image" content="https://cdn.hscstack.site/thumbnails/calc.png">', false); |
118 | 138 | }); |
0 commit comments