Exemplo n.º 1
0
 /**
  * When called will return the string representation
  */
 public function testWhenCalledWillReturnTheStringRepresentation()
 {
     $labelValue = 'testing';
     $label = new Label($labelValue);
     static::assertInternalType('string', $label->toString());
     static::assertEquals($labelValue, $label->toString());
 }
Exemplo n.º 2
0
 /**
  * When called will return the array representation
  */
 public function testWhenCalledWillReturnTheArrayRepresentation()
 {
     $labelValue = 'testing';
     $label = new Label($labelValue);
     static::assertInternalType('array', $label->toArray());
     return [$labelValue, $label];
 }
Exemplo n.º 3
0
 /**
  * When called with options and 'string' will return the string representation in a JSON string
  */
 public function testWhenCalledWithOptionsAndStringWillReturnTheStringRepresentationInAJSONString()
 {
     $labelValue = 'testing';
     $label = new Label($labelValue);
     $options = 0;
     static::assertInternalType('string', $label->toJson($options, 'string'));
     static::assertEquals(json_encode($labelValue, $options), $label->toJson($options, 'string'));
     return [$labelValue, $label, $options];
 }
Exemplo n.º 4
0
 /**
  * When called with a different object with different class will throw an exception
  */
 public function testWhenCalledWithADifferentObjectWithDifferentClassWillThrowAnException()
 {
     $labelValue = 'testing';
     $labelValueTwo = 'notTesting';
     $label = new Label($labelValue);
     $labelTwo = new \stdClass();
     $labelTwo->value = $labelValueTwo;
     try {
         $label->equals($labelTwo);
     } catch (\PHPUnit_Framework_Error $e) {
         static::assertStringStartsWith('Argument 1 passed to Xqddd\\Notifications\\Label::equals() must be an instance of Xqddd\\Notifications\\Label,', $e->getMessage());
         static::assertEquals(4096, $e->getCode());
     }
 }
Exemplo n.º 5
0
 /**
  * When called will return the value stored
  */
 public function testWhenCalledWillReturnTheValueStored()
 {
     $labelValue = 'testing';
     $label = new Label($labelValue);
     static::assertSame($labelValue, $label->getValue());
 }
Exemplo n.º 6
0
 /**
  * @param Label $label
  * @return bool
  */
 public function equals(Label $label)
 {
     return $this->value === $label->getValue();
 }