You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.5 KiB
89 lines
1.5 KiB
7 years ago
|
<?php
|
||
|
/**
|
||
|
* Part of the Fuel framework.
|
||
|
*
|
||
|
* @package Fuel
|
||
|
* @version 1.8
|
||
|
* @author Fuel Development Team
|
||
|
* @license MIT License
|
||
|
* @copyright 2010 - 2016 Fuel Development Team
|
||
|
* @link http://fuelphp.com
|
||
|
*/
|
||
|
|
||
|
namespace Fuel\Core;
|
||
|
|
||
|
/**
|
||
|
* Event class tests
|
||
|
*
|
||
|
* @group Core
|
||
|
* @group Event
|
||
|
*/
|
||
|
class Test_Event extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* Test for Event::register()
|
||
|
*
|
||
|
* @test
|
||
|
*/
|
||
|
public function test_register_valid()
|
||
|
{
|
||
|
$output = Event::register('test_register_valid', 'Str::upper');
|
||
|
$this->assertTrue($output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Test for Event::has_events()
|
||
|
*
|
||
|
* @test
|
||
|
*/
|
||
|
public function test_hasevents_valid()
|
||
|
{
|
||
|
$output = Event::has_events('test_register_valid');
|
||
|
$this->assertTrue($output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Test for Event::trigger()
|
||
|
*
|
||
|
* @test
|
||
|
*/
|
||
|
public function test_trigger_valid()
|
||
|
{
|
||
|
$output = Event::trigger('test_register_valid', 'text to upper');
|
||
|
$this->assertEquals('TEXT TO UPPER', $output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Test for Event::register()
|
||
|
*
|
||
|
* @test
|
||
|
*/
|
||
|
public function test_register_invalid()
|
||
|
{
|
||
|
$output = Event::register('test_register_invalid', 'Imaginary::callback');
|
||
|
$this->assertFalse($output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Test for Event::has_events()
|
||
|
*
|
||
|
* @test
|
||
|
*/
|
||
|
public function test_hasevents_invalid()
|
||
|
{
|
||
|
$output = Event::has_events('test_register_invalid');
|
||
|
$this->assertFalse($output);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Test for Event::trigger()
|
||
|
*
|
||
|
* @test
|
||
|
*/
|
||
|
public function test_trigger_invalid()
|
||
|
{
|
||
|
$output = Event::trigger('test_register_invalid', 'text to upper');
|
||
|
$this->assertEquals('', $output);
|
||
|
}
|
||
|
}
|