-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from goodjun/dev
optimize test case
- Loading branch information
Showing
4 changed files
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace LUIS\Tests\Models; | ||
|
||
use Goodjun\LUIS\Models\App; | ||
|
||
class AppTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testConstruct() | ||
{ | ||
$app = new App([ | ||
'name' => 'name', | ||
'description' => 'description', | ||
'domain' => 'domain', | ||
'culture' => 'en-us', | ||
'tokenizerVersion' => '1.0', | ||
'usageScenario' => 'usage', | ||
'initialVersionId' => '0.1', | ||
]); | ||
|
||
$this->assertEquals('name', $app->getName()); | ||
$this->assertEquals('description', $app->getDescription()); | ||
$this->assertEquals('domain', $app->getDomain()); | ||
$this->assertEquals('en-us', $app->getCulture()); | ||
$this->assertEquals('0.1', $app->getInitialVersionId()); | ||
$this->assertEquals('1.0', $app->getTokenizerVersion()); | ||
$this->assertEquals('usage', $app->getUsageScenario()); | ||
} | ||
|
||
public function testSetterGetter() | ||
{ | ||
$app = new App(); | ||
|
||
$app->setName('name') | ||
->setDescription('description') | ||
->setDomain('domain') | ||
->setCulture('en-us') | ||
->setInitialVersionId('0.1') | ||
->setTokenizerVersion('1.0') | ||
->setUsageScenario('usage'); | ||
|
||
$this->assertEquals('name', $app->getName()); | ||
$this->assertEquals('description', $app->getDescription()); | ||
$this->assertEquals('domain', $app->getDomain()); | ||
$this->assertEquals('en-us', $app->getCulture()); | ||
$this->assertEquals('0.1', $app->getInitialVersionId()); | ||
$this->assertEquals('1.0', $app->getTokenizerVersion()); | ||
$this->assertEquals('usage', $app->getUsageScenario()); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace LUIS\Tests\Models; | ||
|
||
use Goodjun\LUIS\Models\ModelAbstract; | ||
|
||
class ModelAbstractTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testToArray() | ||
{ | ||
$stub = $this->getMockForAbstractClass(ModelAbstract::class); | ||
|
||
$stub->expects($this->any()) | ||
->method('toArray') | ||
->will($this->returnValue([])); | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace LUIS\Tests\Models; | ||
|
||
use Goodjun\LUIS\Models\Utterance; | ||
|
||
class UtteranceTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testConstruct() | ||
{ | ||
$utterance = new Utterance([ | ||
'text' => 'text', | ||
'intentName' => 'intent name', | ||
'entityLabels' => [], | ||
]); | ||
|
||
$this->assertEquals('text', $utterance->getText()); | ||
$this->assertEquals('intent name', $utterance->getIntentName()); | ||
$this->assertEquals([], $utterance->getEntityLabels()); | ||
} | ||
|
||
public function testSetterGetter() | ||
{ | ||
$utterance = new Utterance(); | ||
|
||
$utterance->setText('text') | ||
->setIntentName('intent name') | ||
->setEntityLabels([]); | ||
|
||
$this->assertEquals('text', $utterance->getText()); | ||
$this->assertEquals('intent name', $utterance->getIntentName()); | ||
$this->assertEquals([], $utterance->getEntityLabels()); | ||
} | ||
} |
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,4 @@ | ||
<?php | ||
|
||
$classLoader = require dirname(__DIR__).'/vendor/autoload.php'; | ||
$classLoader->register(true); |