ShowTipInHomeTest.php 978 Bytes
<?php

namespace FootyRoom\Tests;

use FootyRoom\Support\MongoClient;
use FootyRoom\Config;

class ShowTipInHomeTest extends TestCase
{
    use SetsUpFixtures;

    public function setup()
    {
        parent::setup();

        $this->mongoDb = $this->app->make(MongoClient::class)->footyroom;
    }

    public function testShowTipSetToTrueShouldShowTipsInHomePage()
    {
        $response = $this->call('GET', '/');
        $this->assertEquals(200, $response->status());
        $this->assertContains('Betting Tips', $response->getContent());
    }

    public function testShowTipSetToFalseShouldNotShowTipsInHomePage()
    {
        $this->mongoDb->selectCollection('configs')->updateOne(
            ['_id' => 'home-page'],
            ['$set' => [
                'showTips' => false,
            ]]
        );

        $response = $this->call('GET', '/');
        $this->assertEquals(200, $response->status());
        $response->assertDontSee('Betting Tips');
    }
}