Skip to content

Commit

Permalink
Merge pull request #10 from goodjun/dev
Browse files Browse the repository at this point in the history
update name space
  • Loading branch information
goodjun authored Sep 22, 2020
2 parents 5ba4b50 + a07e583 commit 94275e6
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
},
"minimum-stability": "stable",
"autoload": {
"psr-4": {"LUIS\\": "src/LUIS"}
"psr-4": {"Goodjun\\LUIS\\": "src/LUIS"}
}
}
2 changes: 1 addition & 1 deletion src/LUIS/LuisAbstract.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS;
namespace Goodjun\LUIS;

use GuzzleHttp\Client;
use \Exception;
Expand Down
26 changes: 24 additions & 2 deletions src/LUIS/LuisAppClient.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace LUIS;
namespace Goodjun\LUIS;

use LUIS\Models\Utterance;
use Goodjun\LUIS\Models\Utterance;
use \Exception;

class LuisAppClient extends LuisAbstract
Expand Down Expand Up @@ -169,4 +169,26 @@ public function deleteUtterance($utteranceId)
{
return $this->request('DELETE', 'apps/' . $this->appId . '/versions/' . $this->versionId . '/examples/' . $utteranceId);
}

/**
* Get version training status
*
* @return mixed
* @throws Exception
*/
public function trainingStatus()
{
return $this->request('GET', 'apps/' . $this->appId . '/versions/' . $this->versionId . '/train');
}

/**
* Train application version
*
* @return mixed
* @throws Exception
*/
public function train()
{
return $this->request('POST', 'apps/' . $this->appId . '/versions/' . $this->versionId . '/train');
}
}
4 changes: 2 additions & 2 deletions src/LUIS/LuisClient.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace LUIS;
namespace Goodjun\LUIS;

use LUIS\Models\App;
use Goodjun\LUIS\Models\App;
use \Exception;

class LuisClient extends LuisAbstract
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/App.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class App extends ModelAbstract
{
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/Entity.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class Entity extends ModelAbstract
{
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/Intent.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class Intent extends ModelAbstract
{
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/ModelAbstract.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

use ReflectionClass;
use \Exception;
Expand Down
2 changes: 1 addition & 1 deletion src/LUIS/Models/Utterance.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace LUIS\Models;
namespace Goodjun\LUIS\Models;

class Utterance extends ModelAbstract
{
Expand Down
23 changes: 19 additions & 4 deletions tests/LUIS/Tests/FeatureTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace LUIS\Tests;
namespace Goodjun\LUIS\Tests;

use LUIS\LuisClient;
use LUIS\Models\App;
use LUIS\Models\Utterance;
use Goodjun\LUIS\LuisClient;
use Goodjun\LUIS\Models\App;
use Goodjun\LUIS\Models\Utterance;

class FeatureTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -26,6 +26,10 @@ public function setUp()
$location = getenv('LUIS_LOCATION');
$appId = getenv('LUIS_APP_ID');

$primaryKey = '5e821faee38f471582d04cd97ab1b04c';
$location = 'westus';
$appId = '33dbb1e3-ce22-4137-acca-a3b568d58b03';

$this->luisClient = new LuisClient($primaryKey, $location);
$this->appId = $appId;
}
Expand Down Expand Up @@ -107,4 +111,15 @@ public function testCreateDeleteUtterance()
$this->luisClient->app($this->appId)->deleteEntity($entityId);
$this->luisClient->app($this->appId)->deleteIntent($intentId);
}

public function testTrainApp()
{
$response = $this->luisClient->app($this->appId)->version('0.1')->train();
$this->assertNotNull($response);

sleep(3);

$response = $this->luisClient->app($this->appId)->version('0.1')->trainingStatus();
$this->assertNotNull($response);
}
}

0 comments on commit 94275e6

Please sign in to comment.