Merge pull request #11 from dorianneto/master
Add TestCase class in tests
This commit is contained in:
commit
40e6d6d62b
|
|
@ -10,7 +10,8 @@
|
||||||
],
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"LaravelProfane\\": "src/"
|
"LaravelProfane\\": "src/",
|
||||||
|
"LaravelProfaneTests\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
|
use LaravelProfaneTests\TestCase;
|
||||||
use LaravelProfane\ProfaneValidator;
|
use LaravelProfane\ProfaneValidator;
|
||||||
use Illuminate\Support\Facades\Config;
|
|
||||||
use \Mockery as m;
|
|
||||||
|
|
||||||
class ProfaneValidatorTest extends PHPUnit_Framework_TestCase
|
class ProfaneValidatorTest extends TestCase
|
||||||
{
|
{
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
$this->mockConfigs();
|
|
||||||
}
|
|
||||||
public function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
m::close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_can_validate_a_word_with_numbers()
|
public function test_can_validate_a_word_with_numbers()
|
||||||
{
|
{
|
||||||
$attribute = 'username';
|
$attribute = 'username';
|
||||||
|
|
@ -148,17 +138,4 @@ class ProfaneValidatorTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->assertFalse($profane->validate($attribute, $text, $parameters));
|
$this->assertFalse($profane->validate($attribute, $text, $parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mockConfigs()
|
|
||||||
{
|
|
||||||
Config::shouldReceive('get')
|
|
||||||
->once()
|
|
||||||
->with('app.locale')
|
|
||||||
->andReturn('en');
|
|
||||||
|
|
||||||
Config::shouldReceive('has')
|
|
||||||
->once()
|
|
||||||
->with('app.locale')
|
|
||||||
->andReturn(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
|
use LaravelProfaneTests\TestCase;
|
||||||
use LaravelProfane\Str;
|
use LaravelProfane\Str;
|
||||||
|
|
||||||
class StrTest extends PHPUnit_Framework_TestCase
|
class StrTest extends TestCase
|
||||||
{
|
{
|
||||||
public function test_remove_accents_in_spanish_text()
|
public function test_remove_accents_in_spanish_text()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
use \Mockery;
|
||||||
|
|
||||||
|
class TestCase extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* [setUp description]
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->mockConfigs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [tearDown description]
|
||||||
|
* @return [type] [description]
|
||||||
|
*/
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
Mockery::close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [mockConfigs description]
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mockConfigs()
|
||||||
|
{
|
||||||
|
Config::shouldReceive('get')
|
||||||
|
->once()
|
||||||
|
->with('app.locale')
|
||||||
|
->andReturn('en');
|
||||||
|
|
||||||
|
Config::shouldReceive('has')
|
||||||
|
->once()
|
||||||
|
->with('app.locale')
|
||||||
|
->andReturn(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue