Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdual committed Jan 22, 2019
1 parent a0b5698 commit 915050a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/FileNameTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use PHPUnit\Framework\TestCase;

final class FileNameTest extends TestCase
{
public function testName1()
{
$upload = new \iamdual\Uploader(["name" => "foo.png", "type" => "image/png", "tmp_name" => __DIR__ . "/assets/foo.png", "error" => 0, "size" => 1]);
$upload->name("bar");
$upload->check();

$this->assertEquals($upload->get_name(), "bar.png");
}

public function testName2()
{
$upload = new \iamdual\Uploader(["name" => "foo.png", "type" => "image/png", "tmp_name" => __DIR__ . "/assets/foo.png", "error" => 0, "size" => 1]);
$upload->check();

$this->assertEquals($upload->get_name(), "foo.png");
}

public function testName3()
{
$upload = new \iamdual\Uploader(["name" => "foo.png", "type" => "image/png", "tmp_name" => __DIR__ . "/assets/foo.png", "error" => 0, "size" => 1]);
$upload->name("bar.xyz", false);
$upload->check();

$this->assertEquals($upload->get_name(), "bar.xyz");
}
}

0 comments on commit 915050a

Please sign in to comment.