-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added construct method in class Channel
Created test unit
- Loading branch information
Showing
5 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Package Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
<exclude>./tests/TestCase.php</exclude> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
namespace Tests\Models; | ||
|
||
use Tests\TestCase; | ||
use Nikapps\OrtcPhp\Models\Channel; | ||
|
||
class ChannelTest extends TestCase | ||
{ | ||
public function testConstruct() | ||
{ | ||
$channel1 = new Channel('NAME1'); | ||
$this->assertEquals('NAME1', $channel1->getName()); | ||
$this->assertEquals('r', $channel1->getPermission()); | ||
|
||
$channel2 = new Channel('NAME_2', Channel::PERMISSION_WRITE); | ||
$this->assertEquals('NAME_2', $channel2->getName()); | ||
$this->assertEquals('w', $channel2->getPermission()); | ||
} | ||
|
||
public function testSetAndGetAttributes() | ||
{ | ||
$channel = new Channel; | ||
$this->assertEquals($channel, $channel->setName('channel_name')); | ||
$this->assertEquals($channel, $channel->setPermission(Channel::PERMISSION_READ)); | ||
|
||
$this->assertEquals('channel_name', $channel->getName()); | ||
$this->assertEquals('r', $channel->getPermission()); | ||
} | ||
|
||
public function testToString() | ||
{ | ||
$channel = new Channel('foobar'); | ||
$this->assertEquals('foobar', (string) $channel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
namespace Tests; | ||
|
||
use Mockery; | ||
|
||
class TestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function tearDown() | ||
{ | ||
parent::tearDown(); | ||
Mockery::close(); | ||
} | ||
} |