Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test clases #45

Merged
merged 7 commits into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/App/AppAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace FacturaScripts\Core\App;
use Symfony\Component\HttpFoundation\Response;

/**
* Description of App
Expand Down
6 changes: 6 additions & 0 deletions Core/Base/MiniLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,10 @@ public function read(array $levels = ['info', 'notice', 'warning', 'error', 'cri

return $messages;
}


public function clear()
{
self::$dataLog = [];
}
}
12 changes: 9 additions & 3 deletions Test/Core/App/AppAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ protected function tearDown()
{

}

public function testConnect()
{
// Remove the following lines when you implement this test.
$this->assertTrue($this->object->connect());
}


/**
* @covers FacturaScripts\Core\App\AppAPI::run
Expand All @@ -37,8 +44,7 @@ protected function tearDown()
public function testRun()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->assertTrue($this->object->run());
}

}
14 changes: 10 additions & 4 deletions Test/Core/App/AppControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AppControllerTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new AppController;
$this->object = new AppController('.'.DIRECTORY_SEPARATOR);
}

/**
Expand All @@ -30,15 +30,21 @@ protected function tearDown()

}


public function testConnect()
{
// Remove the following lines when you implement this test.
$this->assertTrue($this->object->connect());
}


/**
* @covers FacturaScripts\Core\App\AppController::run
* @todo Implement testRun().
*/
public function testRun()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->assertTrue($this->object->run());
}
}
12 changes: 9 additions & 3 deletions Test/Core/App/AppCronTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ protected function tearDown()

}


public function testConnect()
{
// Remove the following lines when you implement this test.
$this->assertTrue($this->object->connect());
}


/**
* @covers FacturaScripts\Core\App\AppCron::run
* @todo Implement testRun().
*/
public function testRun()
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$this->assertTrue($this->object->run());
}
}
66 changes: 66 additions & 0 deletions Test/Core/Base/CacheTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace FacturaScripts\Core\Base;

/**
* Generated by PHPUnit_SkeletonGenerator on 2017-07-24 at 16:53:33.
*/
class CacheTest extends \PHPUnit_Framework_TestCase {

/**
* @var Cache
*/
protected $object;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new Cache;
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {

}

/**
* @covers FacturaScripts\Core\Base\Cache::get
* @todo Implement testGet().
*/
public function testGet() {
// Remove the following lines when you implement this test.
$this->object->set('TEST', 1234);
$data = $this->object->get('TEST');
$this->assertEquals(1234, $data);
}


/**
* @covers FacturaScripts\Core\Base\Cache::delete
* @todo Implement testDelete().
*/
public function testDelete() {
// Remove the following lines when you implement this test.
$this->object->set('TEST', 1234);
$this->object->delete('TEST');
$this->assertEmpty($this->object->get('TEST'));
}

/**
* @covers FacturaScripts\Core\Base\Cache::clear
* @todo Implement testClear().
*/
public function testClear() {
// Remove the following lines when you implement this test.
$this->object->set('TEST_1', 12345);
$this->object->clear();
$this->assertEmpty($this->object->get('TEST_1'));

}

}
142 changes: 142 additions & 0 deletions Test/Core/Base/DefaultItemsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<?php

namespace FacturaScripts\Core\Base;

/**
* Generated by PHPUnit_SkeletonGenerator on 2017-07-24 at 16:46:47.
*/
class DefaultItemsTest extends \PHPUnit_Framework_TestCase {

/**
* @var DefaultItems
*/
protected $object;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new DefaultItems;
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {

}

/**
* @covers FacturaScripts\Core\Base\DefaultItems::codEjercicio
* @todo Implement testCodEjercicio().
*/
public function testCodEjercicio() {
// Remove the following lines when you implement this test.
$this->object->setCodEjercicio(1);
$data = $this->object->codEjercicio();
$this->assertEquals(1, $data);
}


/**
* @covers FacturaScripts\Core\Base\DefaultItems::codAlmacen
* @todo Implement testCodAlmacen().
*/
public function testCodAlmacen() {
// Remove the following lines when you implement this test.
$this->object->setCodAlmacen(1);
$data = $this->object->codAlmacen();
$this->assertEquals(1, $data);
}


/**
* @covers FacturaScripts\Core\Base\DefaultItems::codDivisa
* @todo Implement testCodDivisa().
*/
public function testCodDivisa() {
// Remove the following lines when you implement this test.
$this->object->setCodDivisa(1);
$data = $this->object->codDivisa();
$this->assertEquals(1, $data);
}


/**
* @covers FacturaScripts\Core\Base\DefaultItems::codPago
* @todo Implement testCodPago().
*/
public function testCodPago() {
// Remove the following lines when you implement this test.
$this->object->setCodPago(1);
$data = $this->object->codPago();
$this->assertEquals(1, $data);
}


/**
* @covers FacturaScripts\Core\Base\DefaultItems::codImpuesto
* @todo Implement testCodImpuesto().
*/
public function testCodImpuesto() {
// Remove the following lines when you implement this test.
$this->object->setCodImpuesto(1);
$data = $this->object->codImpuesto();
$this->assertEquals(1, $data);
}


/**
* @covers FacturaScripts\Core\Base\DefaultItems::codPais
* @todo Implement testCodPais().
*/
public function testCodPais() {
// Remove the following lines when you implement this test.
$this->object->setCodPais(1);
$data = $this->object->codPais();
$this->assertEquals(1, $data);
}


/**
* @covers FacturaScripts\Core\Base\DefaultItems::codSerie
* @todo Implement testCodSerie().
*/
public function testCodSerie() {
// Remove the following lines when you implement this test.
$this->object->setCodSerie(1);
$data = $this->object->codSerie();
$this->assertEquals(1, $data);
}



/**
* @covers FacturaScripts\Core\Base\DefaultItems::defaultPage
* @todo Implement testDefaultPage().
*/
public function testDefaultPage() {
// Remove the following lines when you implement this test.
$this->object->setDefaultPage('principal');
$data = $this->object->defaultPage();
$this->assertEquals('principal', $data);
}



/**
* @covers FacturaScripts\Core\Base\DefaultItems::showingPage
* @todo Implement testShowingPage().
*/
public function testShowingPage() {
// Remove the following lines when you implement this test.
$this->object->setShowingPage('default');
$data = $this->object->showingPage();
$this->assertEquals('default', $data);
}



}
56 changes: 56 additions & 0 deletions Test/Core/Base/IPFilterTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace FacturaScripts\Core\Base;

/**
* Generated by PHPUnit_SkeletonGenerator on 2017-07-20 at 11:48:14.
*/
class IPFilterTest extends \PHPUnit_Framework_TestCase {

/**
* @var IPFilter
*/
protected $object;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new IPFilter;
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {

}

/**
* @covers FacturaScripts\Core\Base\IPFilter::setAttempt
* @todo Implement testSetAttempt().
*/
public function testSetAttempt() {
// Remove the following lines when you implement this test.
$this->object->setAttempt('192.168.1.1');
$this->object->setAttempt('192.168.1.1');
$this->object->setAttempt('192.168.1.1');
$this->object->setAttempt('192.168.1.1');
$this->object->setAttempt('192.168.1.1');
$this->object->setAttempt('192.168.1.1');
$file = file_get_contents('/Cache/ip.list');
$this->assertNotEmpty($file);
}

/**
* @covers FacturaScripts\Core\Base\IPFilter::isBanned
* @todo Implement testIsBanned().
*/
public function testIsBanned() {
// Remove the following lines when you implement this test.
$this->assertTrue($this->object->isBanned('192.168.1.1'));
}

}