BaseTest.php 941 Bytes
Newer Older
1 2 3 4
<?php

class BaseTest extends PHPUnit_Framework_TestCase
{
5 6
	public function test__qa_js()
	{
Scott committed
7 8
		$this->assertSame("'test'", qa_js('test'));
		$this->assertSame("'test'", qa_js('test', true));
9

Scott committed
10 11
		$this->assertSame(123,      qa_js(123));
		$this->assertSame("'123'",  qa_js(123, true));
12

Scott committed
13 14
		$this->assertSame('true',   qa_js(true));
		$this->assertSame("'true'", qa_js(true, true));
15
	}
16 17 18

	public function test__convert_to_bytes()
	{
Scott committed
19 20 21
		$this->assertSame(      102400, convert_to_bytes('k', 100));
		$this->assertSame(   104857600, convert_to_bytes('m', 100));
		$this->assertSame(107374182400, convert_to_bytes('g', 100));
22

Scott committed
23 24 25
		$this->assertSame(      102400, convert_to_bytes('K', 100));
		$this->assertSame(   104857600, convert_to_bytes('M', 100));
		$this->assertSame(107374182400, convert_to_bytes('G', 100));
26

Scott committed
27 28
		$this->assertSame(         100, convert_to_bytes('',  100));
		$this->assertSame(     1048576, convert_to_bytes('k', 1024));
29 30
	}

31
}