Пример #1
0
 /**
  * typeOf test
  */
 public function testTypeOf()
 {
     $naming = new Naming();
     $this->assertNull($naming->typeOf(''), 'should not determine');
     $this->assertNull($naming->typeOf([]), 'should not array');
     $this->assertNull($naming->typeOf(['bem' => 'hello']), 'should not determine not valid array');
     $this->assertNull($naming->typeOf(['elem' => 'elem']), 'should not determine array without `block` field');
     $this->assertNull($naming->typeOf(['block' => 'block', 'modName' => 'mod', 'modVal' => false]), 'should not determine mod of block if `modVal` field equal `false`');
     $this->assertNull($naming->typeOf(['block' => 'block', 'elem' => 'elem', 'modName' => 'mod', 'modVal' => false]), 'should not determine mod of elem if `modVal` field equal `false`');
     $this->assertContains($naming->typeOf(['block' => 'block']), 'block', 'should determine block');
     $this->assertContains($naming->typeOf(['block' => 'block', 'modName' => 'mod', 'modVal' => 'modVal']), 'blockMod', 'should determine mod of block');
     $this->assertContains($naming->typeOf(['block' => 'block', 'modName' => 'mod', 'modVal' => true]), 'blockMod', 'should determine boolean mod of block');
     $this->assertContains($naming->typeOf(['block' => 'block', 'elem' => 'elem']), 'elem', 'should determine elem');
     $this->assertContains($naming->typeOf(['block' => 'block', 'elem' => 'elem', 'modName' => 'mod', 'modVal' => 'val']), 'elemMod', 'should determine mod of elem');
     $this->assertContains($naming->typeOf(['block' => 'block', 'elem' => 'elem', 'modName' => 'mod', 'modVal' => true]), 'elemMod', 'should determine boolean mod of elem');
 }