tainacan/tests/test-logs.php

43 lines
1.0 KiB
PHP
Raw Normal View History

<?php
2017-11-15 18:50:11 +00:00
namespace Tainacan\Tests;
/**
* Class TestCollections
*
* @package Test_Tainacan
*/
/**
* Sample test case.
*/
2017-11-15 18:50:11 +00:00
class Logs extends \WP_UnitTestCase {
/**
* 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();
//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();
//inserindo
$log = $Tainacan_Logs->insert($log);
//retorna a taxonomia
$test = $Tainacan_Logs->fetch($log->get_id());
$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() );
}
}