File tree Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 22namespace InfluxDB \Adapter \Http ;
33
44use GuzzleHttp \Client ;
5+ use InfluxDB \Adapter \WriterTrait ;
56use InfluxDB \Adapter \Http \Options ;
6- use InfluxDB \Adapter \WriterAbstract ;
7+ use InfluxDB \Adapter \WritableInterface ;
78
8- class Writer extends WriterAbstract
9+ class Writer implements WritableInterface
910{
11+ use WriterTrait;
12+
1013 private $ httpClient ;
1114 private $ options ;
1215
Original file line number Diff line number Diff line change 11<?php
22namespace InfluxDB \Adapter \Udp ;
33
4- use InfluxDB \Adapter \WriterAbstract ;
4+ use InfluxDB \Adapter \WriterTrait ;
55use InfluxDB \Adapter \Udp \Options ;
6+ use InfluxDB \Adapter \WritableInterface ;
67
7- class Writer extends WriterAbstract
8+ class Writer implements WritableInterface
89{
10+ use WriterTrait;
11+
912 private $ options ;
1013
1114 public function __construct (Options $ options )
Original file line number Diff line number Diff line change 22namespace InfluxDB \Adapter ;
33
44use DateTime ;
5- use InfluxDB \Adapter \WritableInterface ;
65
7- abstract class WriterAbstract implements WritableInterface
6+ trait WriterTrait
87{
9- abstract public function send (array $ message );
10-
11- protected function messageToLineProtocol (array $ message , array $ tags = [])
8+ public function messageToLineProtocol (array $ message , array $ tags = [])
129 {
1310 if (!array_key_exists ("points " , $ message )) {
1411 return ;
Original file line number Diff line number Diff line change 55use InfluxDB \Type \IntType ;
66use InfluxDB \Type \FloatType ;
77
8- class WriterAbstractTest extends \PHPUnit_Framework_TestCase
8+ class WriterTraitTest extends \PHPUnit_Framework_TestCase
99{
1010 /**
1111 * @dataProvider getElements
1212 */
1313 public function testListToLineValues ($ message , $ result )
1414 {
15- $ helper = $ this ->getMockBuilder ("InfluxDB \\Adapter \\WriterAbstract " )
16- ->getMockForAbstractClass ();
15+ $ helper = $ this ->getMockBuilder ("InfluxDB \\Adapter \\WriterTrait " )
16+ ->getMockForTrait ();
1717
1818 $ method = new ReflectionMethod (get_class ($ helper ), "pointsToString " );
1919 $ method ->setAccessible (true );
You can’t perform that action at this time.
0 commit comments