Ejemplo n.º 1
0
 public function testExecutesWithValueFromKey()
 {
     $stubCallback = new StubCallback();
     $obj = new KeyOther([$stubCallback, 'setArgs'], 'KEY');
     $obj->setData(['NOT' => 2, 'KEY' => 6, 'Other_Not' => 'Other']);
     $obj->execute();
     $this->assertSame([['NOT' => 2, 'Other_Not' => 'Other']], $stubCallback->getArgs());
 }
Ejemplo n.º 2
0
 public function testExecutesWithNoParameters()
 {
     $stubCallback = new StubCallback();
     $obj = new AlwaysNone([$stubCallback, 'setArgs']);
     $obj->setData(['NOT' => 2, 'ANOTHER' => 6]);
     $obj->execute();
     $this->assertSame([], $stubCallback->getArgs());
 }
Ejemplo n.º 3
0
 public function testExecutesWithNoParams()
 {
     $stubCallback = new StubCallback();
     $obj = new KeyOnly([$stubCallback, 'setArgs'], 'KEY');
     $obj->setData(['NOT' => 2, 'KEY' => 6]);
     $obj->execute();
     $this->assertSame([], $stubCallback->getArgs());
 }
Ejemplo n.º 4
0
 public function testExecute()
 {
     $stubCallback = new StubCallback();
     $obj = new KeyOtherValue([$stubCallback, 'setArgs'], 'ONE', 'TWO');
     $obj->setData(['ONE' => 1, 'TWO' => 2, 'DC' => 3]);
     $obj->execute();
     $this->assertSame([2], $stubCallback->getArgs());
 }
Ejemplo n.º 5
0
 public function testSetData()
 {
     $stubCallback = new StubCallback();
     $obj = new Concrete([$stubCallback, 'SetArgs']);
     $args = ['One' => 1, 'Two' => 2];
     $obj->setData($args);
     $obj->execute();
     $this->assertSame(array_values($args), $stubCallback->getArgs());
 }
Ejemplo n.º 6
0
 public function testExecutesWithEmpty()
 {
     $stubCallback = new StubCallback();
     $obj = new Blank([$stubCallback, 'setArgs']);
     $obj->setData([]);
     $obj->execute();
     $this->assertSame([], $stubCallback->getArgs());
     $this->assertSame([[]], $stubCallback->getArgsStack());
 }