コード例 #1
0
 /**
  * @author Andreas Glaser
  */
 public function testStringEndsWith()
 {
     $this->assertTrue(StringHelper::endsWith($this->testString, 'string.', true));
     $this->assertFalse(StringHelper::endsWith($this->testString, 'string!', true));
     $this->assertTrue(StringHelper::endsWith($this->testString, 'STRING.', false));
     // strings always "end" with null/nothing
     $this->assertTrue(StringHelper::endsWith($this->testString, null, true));
     $this->assertTrue(StringHelper::endsWith($this->testString, null, false));
 }
コード例 #2
0
 /**
  * @return bool
  * @author Andreas Glaser
  */
 public function supports()
 {
     $eehClassFullyQualified = get_called_class();
     if (!StringHelper::endsWith($eehClassFullyQualified, 'EEH')) {
         return false;
     }
     $eehClass = substr($eehClassFullyQualified, strrpos($eehClassFullyQualified, '\\') + 1, -3);
     $entityClassFullyQualified = get_class($this->entity);
     $entityClass = substr($entityClassFullyQualified, strrpos($entityClassFullyQualified, '\\') + 1);
     return $eehClass === $entityClass;
 }