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.
PlexShare/fuel/core/tests/lang.php

73 lines
1.3 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;
/**
* Lang class tests
*
* @group Core
* @group Lang
*/
class Test_Lang extends TestCase
{
/**
* Test for Lang::get()
*
* @test
*/
public function test_line()
{
Lang::load('test');
$output = Lang::get('hello', array('name' => 'Bob'));
$expected = 'Hello there Bob!';
$this->assertEquals($expected, $output);
}
/**
* Test for Lang::get()
*
* @test
*/
public function test_line_invalid()
{
Lang::load('test');
$output = Lang::get('non_existant_hello', array('name' => 'Bob'));
$expected = false;
$this->assertEquals($expected, $output);
}
/**
* Test for Lang::set()
*
* @test
*/
public function test_set_return_true()
{
$output = Lang::set('testing_set_valid', 'Ahoy :name!');
$this->assertNull($output);
}
/**
* Test for Lang::set()
*
* @test
*/
public function test_set()
{
Lang::set('testing_set_valid', 'Ahoy :name!');
$output = Lang::get('testing_set_valid', array('name' => 'Bob'));
$expected = 'Ahoy Bob!';
$this->assertEquals($expected, $output);
}
}