2017-11-13 23:23:13 +00:00
|
|
|
<?php
|
2017-11-15 18:50:11 +00:00
|
|
|
|
|
|
|
namespace Tainacan\Tests;
|
|
|
|
|
2017-11-13 23:23:13 +00:00
|
|
|
/**
|
|
|
|
* Class TestCollections
|
|
|
|
*
|
|
|
|
* @package Test_Tainacan
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sample test case.
|
|
|
|
*/
|
2017-11-15 18:50:11 +00:00
|
|
|
class Logs extends \WP_UnitTestCase {
|
2017-11-13 23:23:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Teste da insercao de um log simples apenas se criar o dado bruto
|
|
|
|
*/
|
|
|
|
function test_add() {
|
|
|
|
global $Tainacan_Logs;
|
|
|
|
|
2017-11-15 18:50:11 +00:00
|
|
|
$log = new \Tainacan\Entities\Log();
|
2017-11-13 23:23:13 +00:00
|
|
|
|
|
|
|
//setando os valores na classe do tainacan
|
|
|
|
$log->set_title('blame someone');
|
|
|
|
$log->set_description('someone did that');
|
2017-11-21 01:31:46 +00:00
|
|
|
|
|
|
|
$user_id = get_current_user_id();
|
|
|
|
$blog_id = get_current_blog_id();
|
2017-11-13 23:23:13 +00:00
|
|
|
|
|
|
|
//inserindo
|
|
|
|
$log = $Tainacan_Logs->insert($log);
|
|
|
|
|
|
|
|
//retorna a taxonomia
|
2017-11-20 17:24:07 +00:00
|
|
|
$test = $Tainacan_Logs->fetch($log->get_id());
|
2017-11-13 23:23:13 +00:00
|
|
|
|
|
|
|
$this->assertEquals( 'blame someone', $test->get_title() );
|
|
|
|
$this->assertEquals( 'someone did that', $test->get_description() );
|
2017-11-21 01:31:46 +00:00
|
|
|
$this->assertEquals( $user_id, $test->get_user_id() );
|
|
|
|
$this->assertEquals( $blog_id, $test->get_blog_id() );
|
2017-11-13 23:23:13 +00:00
|
|
|
}
|
|
|
|
}
|