public function testGetData() { $customersObject = new App\Customers(); $distanceObject = new App\Distance(); $centerPointObj = new App\CenterPoint(); $calc = new App\CalculateCustomersDistance($distanceObject, $customersObject, $centerPointObj); $results = $calc->getResult(); $this->assertEquals($results, $this->getExpectedData()); }
<?php require_once 'config.php'; $customersObject = new App\Customers(); $distanceObject = new App\Distance(); $centerPointObj = new App\CenterPoint(); $calc = new App\CalculateCustomersDistance($distanceObject, $customersObject, $centerPointObj); $results = $calc->getResult(); if (is_array($results)) { $output = array(); foreach ($results as $userId => $userData) { $output[] = "id: {$userId}, name: {$userData['name']}, distance: {$userData['distance']} km"; } echo "\n\n"; echo implode("\n", $output); echo "\n\n"; }