Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test improvement #13

Merged
merged 1 commit into from Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -7,7 +7,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- 7.4
- nightly

matrix:
Expand Down
10 changes: 3 additions & 7 deletions tests/FactoryTest.php
Expand Up @@ -2,9 +2,9 @@

namespace PUGX\Shortid\Test;

use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
use PUGX\Shortid\Factory;
use RandomLib\Factory as RandomLibFactory;

final class FactoryTest extends TestCase
{
Expand Down Expand Up @@ -48,22 +48,18 @@ public function alphabetsProvider(): array
}

/**
* @param string $alphabet
*
* @dataProvider alphabetsProvider
*/
public function testSetAlphabet(string $alphabet): void
{
$this->factory->setAlphabet($alphabet);

$newAlphabet = Assert::readAttribute($this->factory, 'alphabet');
$newAlphabet = $this->factory->getAlphabet();

$this->assertSame($alphabet, $newAlphabet);
}

/**
* @param string $alphabet
*
* @dataProvider wrongAlphabetsProvider
*/
public function testSetWrongAlphabet(string $alphabet): void
Expand All @@ -88,7 +84,7 @@ public function testGetFactory(): void
{
$factory = Factory::getFactory();

$this->assertInstanceOf('RandomLib\Factory', $factory);
$this->assertInstanceOf(RandomLibFactory::class, $factory);
}

public function testSetLength(): void
Expand Down
3 changes: 2 additions & 1 deletion tests/ShortidTest.php
Expand Up @@ -2,6 +2,7 @@

namespace PUGX\Shortid\Test;

use JsonSerializable;
use PHPUnit\Framework\TestCase;
use PUGX\Shortid\Factory;
use PUGX\Shortid\Shortid;
Expand Down Expand Up @@ -74,7 +75,7 @@ public function testJsonSerializable(): void
{
$generated = Shortid::generate();

$this->assertInstanceOf('JsonSerializable', $generated);
$this->assertInstanceOf(JsonSerializable::class, $generated);
}

public function testJsonEncode(): void
Expand Down