set('app.debug', false); app()->setLocale('en'); if (! Schema::hasTable('blocks')) { Schema::create('blocks', function (Blueprint $table) { $table->increments('block_id'); $table->string('keycode', 64)->unique(); $table->text('attributes')->nullable(); $table->text('notes')->nullable(); $table->boolean('active')->default(true); $table->string('block_group', 16)->nullable(); $table->timestamps(); }); } $keycode = 'test-block-render-html'; $html = '

Title

Bold Italic

'; DB::table('blocks')->where('keycode', $keycode)->delete(); DB::table('blocks')->insert([ 'keycode' => $keycode, 'attributes' => json_encode([ app()->getLocale() => [ 'content' => $html, ], ]), 'notes' => null, 'active' => true, 'block_group' => null, 'created_at' => now(), 'updated_at' => now(), ]); try { $output = (new BlockComponent($keycode))->render()->render(); expect(trim($output))->toBe($html); expect($output)->not->toContain('<'); expect($output)->not->toContain('&'); } finally { DB::table('blocks')->where('keycode', $keycode)->delete(); } });