server/src/tests/Controllers/ViafControllerTest.php
changeset 537 d2e6ee099125
parent 407 2dba812c7ef2
equal deleted inserted replaced
536:b64c8c35c67d 537:d2e6ee099125
    34             ->andReturn([
    34             ->andReturn([
    35                 '56666014' => 'Guylaine Brun-Trigaud',
    35                 '56666014' => 'Guylaine Brun-Trigaud',
    36                 '93752300' => 'Sonia Branca-Rosoff'
    36                 '93752300' => 'Sonia Branca-Rosoff'
    37             ]);
    37             ]);
    38         $response = $this->get('/api/v1/resolvers/viaf/93752300,56666014')->
    38         $response = $this->get('/api/v1/resolvers/viaf/93752300,56666014')->
    39             seeJsonEquals(['viafids' => [
    39             assertJson(['viafids' => [
    40                 '56666014' => 'Guylaine Brun-Trigaud',
    40                 '56666014' => 'Guylaine Brun-Trigaud',
    41                 '93752300' => 'Sonia Branca-Rosoff'
    41                 '93752300' => 'Sonia Branca-Rosoff'
    42             ]]);
    42             ]]);
    43     }
    43     }
    44 
    44 
    49             ->once()
    49             ->once()
    50             ->andReturn([
    50             ->andReturn([
    51                 '93752300' => 'Sonia Branca-Rosoff'
    51                 '93752300' => 'Sonia Branca-Rosoff'
    52             ]);
    52             ]);
    53         $response = $this->get('/api/v1/resolvers/viaf/93752300')->
    53         $response = $this->get('/api/v1/resolvers/viaf/93752300')->
    54             seeJsonEquals(['viafids' => [
    54             assertJson(['viafids' => [
    55                 '93752300' => 'Sonia Branca-Rosoff'
    55                 '93752300' => 'Sonia Branca-Rosoff'
    56             ]]);
    56             ]]);
    57     }
    57     }
    58 
    58 
    59     public function testShowUnknown() {
    59     public function testShowUnknown() {
    63             ->once()
    63             ->once()
    64             ->andReturn([
    64             ->andReturn([
    65                 '12345' => null
    65                 '12345' => null
    66             ]);
    66             ]);
    67         $response = $this->get('/api/v1/resolvers/viaf/12345')->
    67         $response = $this->get('/api/v1/resolvers/viaf/12345')->
    68             seeJsonEquals(['viafids' => [
    68             assertJson(['viafids' => [
    69                 '12345' => null
    69                 '12345' => null
    70             ]]);
    70             ]]);
    71     }
    71     }
    72 
    72 
    73     public function testShowMalformed() {
    73     public function testShowMalformed() {
    76             ->with(['abcdef','ghij'])
    76             ->with(['abcdef','ghij'])
    77             ->once()
    77             ->once()
    78             ->andThrow('CorpusParole\Services\ViafResolverException', "ViafId not in correct format", 500);
    78             ->andThrow('CorpusParole\Services\ViafResolverException', "ViafId not in correct format", 500);
    79         $response = $this->get('/api/v1/resolvers/viaf/abcdef,ghij');
    79         $response = $this->get('/api/v1/resolvers/viaf/abcdef,ghij');
    80 
    80 
    81         $this->assertResponseStatus(500);
    81         $response->assertStatus(500);
    82     }
    82     }
    83 
    83 
    84 }
    84 }