public function testMemberCount() { $data = new \SimpleXMLElement(getFixture('valve-members.xml')); $mockBuilder = $this->getMockBuilder('\\SteamCondenser\\Community\\SteamGroup'); $mockBuilder->setConstructorArgs(['valve', false]); $mockBuilder->setMethods(['getData']); $group = $mockBuilder->getMock(); $group->expects($this->once())->method('getData')->with('http://steamcommunity.com/groups/valve/memberslistxml?p=1')->will($this->returnValue($data)); $this->assertEquals(239, $group->getMemberCount()); $this->assertTrue($group->isFetched()); }
public function testFetch() { $data = new \SimpleXMLElement(getFixture('sonofthor.xml')); $mockBuilder = $this->getMockBuilder('\\SteamCondenser\\Community\\SteamId'); $mockBuilder->setConstructorArgs(['Son_of_Thor', false]); $mockBuilder->setMethods(['getData']); $steamId = $mockBuilder->getMock(); $steamId->expects($this->once())->method('getData')->with('http://steamcommunity.com/id/son_of_thor?xml=1')->will($this->returnValue($data)); $steamId->fetch(); $this->assertEquals('76561197983311154', $steamId->getSteamId64()); $this->assertTrue($steamId->isFetched()); }
* middleware transforms it into the fixture data. * * Note: Specter requires Slim 3.3 or newer, after a fix for seeking on temp * php streams. See: https://github.com/slimphp/Slim/issues/1434 */ /** * Replace this with something of your own, a way to load the Specter JSON * fixture file. * * @param string $name fixture file name * * @return mixed */ function getFixture($name) { $path = BASE_DIR . '/fixture/' . $name . '.json'; $data = file_get_contents($path); return json_decode($data); } /** * An example route group for API endpoints */ $app->group('/api/v1', function () use($app) { /** * An example customer endpoint, returning a random customer. */ $app->get('/customer/{id}', function ($request, $response, $args) { return $response->withJson(getFixture('customer')); }); })->add(new \HelpScout\Specter\Middleware\SpecterPsr7()); /* End of file Slim3Route.php */
public function testGetPlayerInfoFromGoldSrcAuthenticated() { $status = getFixture('status_goldsrc'); $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock(); $someone = $this->getMock('stdClass', ['addInformation']); $somebody = $this->getMock('stdClass', ['addInformation']); $playerHash = ['someone' => $someone, 'somebody' => $somebody]; $server->playerHash = $playerHash; $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_PLAYER)); $server->expects($this->once())->method('rconExec')->with($this->equalTo('status'))->will($this->returnValue($status)); $someoneData = ['name' => 'someone', 'userid' => '1', 'uniqueid' => 'STEAM_0:0:123456', 'score' => '10', 'time' => '3:52', 'ping' => '12', 'loss' => '0', 'adr' => '0']; $somebodyData = ['name' => 'somebody', 'userid' => '2', 'uniqueid' => 'STEAM_0:0:123457', 'score' => '3', 'time' => '2:42', 'ping' => '34', 'loss' => '0', 'adr' => '0']; $somebody->expects($this->once())->method('addInformation')->with($this->equalTo($somebodyData)); $someone->expects($this->once())->method('addInformation')->with($this->equalTo($someoneData)); $server->rconAuthenticated = true; $server->updatePlayers(); }
</thead> <tfoot> <tr> <th>No</th> <th>Tournament</th> <th>Season</th> <th>Pool</th> <th>Date</th> <th>Team A</th> <th>Team B</th> <th>Venue</th> <th>Action</th> </tr> </tfoot> <?php $f = getFixture(); foreach ($f as $row) { ?> <tr id="<?php echo $row->id; ?> "> <td><?php echo $row->id; ?> </td> <td><?php echo $row->Tournament; ?> </td> <td><?php