This repository has been archived by the owner on May 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New tests, added Orchestra testbench and configured functions to alwa…
…ys return translator object even on failure
- Loading branch information
1 parent
63f176c
commit 6f778c2
Showing
4 changed files
with
114 additions
and
45 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
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 |
---|---|---|
@@ -1,19 +1,51 @@ | ||
<?php | ||
|
||
use FindBrok\WatsonTranslate\Mocks\MockResponses as Response; | ||
use FindBrok\WatsonTranslate\Translator; | ||
use Orchestra\Testbench\TestCase as TestBenchTestCase; | ||
|
||
/** | ||
* Class TestCase | ||
*/ | ||
class TestCase extends PHPUnit_Framework_TestCase | ||
class TestCase extends TestBenchTestCase | ||
{ | ||
/** | ||
* Testing text translate method with sucessfull set of from | ||
* attribute | ||
* Setup | ||
*/ | ||
public function testTranslator_SetFrom_ReturnTranslator() | ||
public function setUp() | ||
{ | ||
|
||
parent::setUp(); | ||
//Create translator class | ||
$this->translator = app()->make('FindBrok\WatsonTranslate\Contracts\TranslatorInterface'); | ||
} | ||
|
||
/** | ||
* Test if the getter really returns the property | ||
* and that property is set | ||
*/ | ||
public function testSetterGetter() | ||
{ | ||
$this->translator->from('en')->to('fr')->usingModel('default'); | ||
$this->assertEquals($this->translator->from, 'en'); | ||
$this->assertEquals($this->translator->to, 'fr'); | ||
$this->assertEquals($this->translator->modelId, config('watson-translate.models.default')); | ||
} | ||
|
||
/** | ||
* Test that when a property does not exists getter | ||
* returns null | ||
*/ | ||
public function testPropertyInexistent_ReturnNull() | ||
{ | ||
$this->assertEquals($this->translator->foo, null); | ||
} | ||
|
||
/** | ||
* Get package providers. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* @return array | ||
*/ | ||
protected function getPackageProviders($app) | ||
{ | ||
return ['FindBrok\WatsonTranslate\WatsonTranslateServiceProvider']; | ||
} | ||
} |