HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/hem-mechatronics.komma.pro/tests/Unit/DocumentTest.php
<?php

use App\Komma\Documents\Models\Document;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;

class DocumentTest extends TestCase
{
    use DatabaseTransactions;

    /**
     * Setup the test environment.
     *
     * @return void
     */
    protected function setUp(): void
    {
        parent::setUp();
    }

    /**
     * @group DocumentTest
     * @test
     */
    public function testDocumentPathUrl()
    {
        //Fake a document that was uploaded on a windows platform (\ Path directory seperators)
        $windowsDocument = new Document();
        $windowsDocument->key                  = 'Documents-page';
        $windowsDocument->name                 = 'Schermafbeelding 2019-04-24 om 12.10.01';
        $windowsDocument->file_system_path     = '\uploads\pages\schermafbeelding-2019-04-24-om-121001-029260100-1557224346.png';
        $windowsDocument->mime_type            = 'image/png';
        $windowsDocument->sort_order           = '1';
        $windowsDocument->documentable_id      = '3';
        $windowsDocument->documentable_type    = 'App\Komma\Pages\Models\Page';
        $windowsDocument->thumb_image_url      = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_thumb.png';
        $windowsDocument->small_image_url      = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_small.png';
        $windowsDocument->medium_image_url     = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_medium.png';
        $windowsDocument->large_image_url      = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_large.png';
        $windowsDocument->created_at           = '2019-05-07 12:19:06';
        $windowsDocument->updated_at           = '2019-05-07 12:19:21';

        $unixDocument = new Document();
        $unixDocument->key                  = 'Documents-page';
        $unixDocument->name                 = 'Schermafbeelding 2019-04-24 om 12.10.01';
        $unixDocument->file_system_path     = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346.png';
        $unixDocument->mime_type            = 'image/png';
        $unixDocument->sort_order           = '1';
        $unixDocument->documentable_id      = '3';
        $unixDocument->documentable_type    = 'App\Komma\Pages\Models\Page';
        $unixDocument->thumb_image_url      = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_thumb.png';
        $unixDocument->small_image_url      = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_small.png';
        $unixDocument->medium_image_url     = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_medium.png';
        $unixDocument->large_image_url      = '/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346_large.png';
        $unixDocument->created_at           = '2019-05-07 12:19:06';
        $unixDocument->updated_at           = '2019-05-07 12:19:21';

        //Assert that the unix document path stays the same when using the
        $this->assertEquals($unixDocument->file_system_path, $unixDocument->file_url);
        $this->assertNotEquals($windowsDocument->file_system_path, $windowsDocument->file_url);
        $this->assertEquals('/uploads/pages/schermafbeelding-2019-04-24-om-121001-029260100-1557224346.png', $windowsDocument->file_url);
    }
}