Example #1
0
 public function testFilter()
 {
     $filter = new Alpha();
     $this->assertEquals(true, $filter->apply('foo'));
     $this->assertEquals(false, $filter->apply('foo123'));
     $this->assertEquals(false, $filter->apply('123'));
     $this->assertEquals(false, $filter->apply('12 3'));
     $this->assertEquals(false, $filter->apply(''));
     $this->assertEquals(false, $filter->apply('foo%&/'));
     // test error message
     $this->assertErrorMessage($filter->getErrorMessage());
 }
Example #2
0
 /**
  * Returns object properties as array
  * 
  * @return array 
  */
 public function toArray()
 {
     $options = array();
     if (isset($this->alpha)) {
         $options['backgroundAlpha'] = $this->alpha->getValue();
     }
     if (isset($this->color)) {
         $options['backgroundColor'] = $this->color->toString();
     }
     return $options;
 }
Example #3
0
 /**
  * Returns object properties as array
  * 
  * @return array 
  */
 public function toArray()
 {
     $options = array();
     if (isset($this->alpha)) {
         $options['borderAlpha'] = $this->alpha->getValue();
     }
     if (isset($this->color)) {
         $options['borderColor'] = $this->color->toString();
     }
     if (isset($this->thickness)) {
         $options['borderThickness'] = $this->thickness;
     }
     return $options;
 }
Example #4
0
 /**
  * 获取语言 不区分大小写
  *  获取值的时候可以动态传参转出语言值
  *  如:\Foundation\Lang::get('_DEBUG_ADD_CLASS_TIP_', '\Foundation\Base') 取出_DEBUG_ADD_CLASS_TIP_语言变量且将\Foundation\base替换语言中的%s
  *
  * @param string $key 支持.获取多维数组
  * @param string $default 不存在的时候默认值
  *
  * @return string
  */
 public static function get($key = null, $default = '')
 {
     if (empty($key)) {
         return '';
     }
     $replace = func_get_args();
     $key = strtolower($key);
     $val = Alpha::doteToArr($key, self::$_content['normal']);
     if (is_null($val)) {
         return $default;
     } else {
         $replace[0] = $val;
         return call_user_func_array('sprintf', array_values($replace));
     }
 }
Example #5
0
 /**
  * @dataProvider providerAdditionalChars
  */
 public function testAdditionalCharsShouldBeRespected($additional, $query)
 {
     $validator = new Alpha($additional);
     $this->assertTrue($validator->validate($query));
 }
 public function testSectionObjectWithFunction()
 {
     $alpha = new Alpha();
     $alpha->foo = new Delta();
     $this->assertEquals('Foo', $alpha->render('{{#foo}}{{name}}{{/foo}}'));
 }
Example #7
0
 /**
  * @dataProvider providerForInvalidAlpha
  * @expectedException Respect\Validation\Exceptions\AlphaException
  */
 public function test_invalid_alphanumeric_chars_should_throw_AlphaException($invalidAlpha, $aditional)
 {
     $validator = new Alpha($aditional);
     $this->assertFalse($validator->validate($invalidAlpha));
     $this->assertFalse($validator->assert($invalidAlpha));
 }
Example #8
0
 /**
  * @dataProvider setOpacityWithWrongValueProvider
  * @expectedException AmCharts\Chart\Setting\Exception\InvalidArgumentException 
  */
 public function testSetOpacityWithWrongValue($opacity)
 {
     $this->alpha->setOpacity($opacity);
 }
Example #9
0
	public function testAutoloadOfModels()
	{
		$this->assertEquals('silly', Alpha::returnSilly());
		
		// Beta is a model in a plugin that is not loaded.
		$this->assertFalse(class_exists('Beta'));
		
		
		// See if loading models not in the model directory works
		$this->assertEquals('silly', AlphaNotInDir::returnSilly());
	}