UrlGeneratorTest.php 1.45 KB
<?php

namespace FootyRoom\Tests;

use FootyRoom\Support\UrlGenerator;
use FootyRoom\Repositories\PostRepository;

class UrlGeneratorTest extends TestCase
{
    public function setUp()
    {
        parent::setUp();

        $this->urlGenerator = $this->app->make(UrlGenerator::class);
        $this->postRepo = $this->app->make(PostRepository::class);
    }

    public function testMatchReview()
    {
        $url = $this->urlGenerator->fromPost(
            $this->postRepo->findById(14326)
        );

        $this->assertEquals(route('matchReview', [
            'id' => 6084,
            'slug' => 'leicester-city-vs-manchester-city',
        ]), $url);
    }

    public function testPage()
    {
        $url = $this->urlGenerator->fromPost(
            $this->postRepo->findById(70063)
        );

        $this->assertEquals(route('transferCenter'), $url);
    }

    public function testMatchPreview()
    {
        $url = $this->urlGenerator->fromPost(
            $this->postRepo->findById(61381)
        );

        $this->assertEquals(route('matchPreview', [
            'id' => 79888528,
            'slug' => 'parma-vs-ac-milan-preview',
        ]), $url);
    }

    public function testLemix()
    {
        $url = $this->urlGenerator->fromPost(
            $this->postRepo->findById(67319)
        );

        $this->assertEquals(route('lemixPost', [
            'id' => 67319,
            'slug' => 'top-10-goals-of-the-week-16032015',
        ]), $url);
    }
}