/** * Check that exception is thrown if incorrect file type provided * * @expectedException \InvalidArgumentException */ public function testDisallowedFileType() { $request = $this->getMockHttpResponse('ClassifySuccess.txt'); $httpClient = $this->getMockHttpClientWithHistoryAndResponses($this->container, [$request]); $this->request = new ClassifyRequest($httpClient); $this->request->initialize(['images_file' => 'Tests/images/hummingbird-1047836_640.tom']); $this->request->send(); }
/** * Test createClassifier failed auth is handled appropriately * * @expectedException \Bobbyshaw\WatsonVisualRecognition\Exceptions\AuthException */ public function testCreateClassifierFailedAuthResponse() { $container = []; $response = $this->getMockHttpResponse('FailedAuth.txt', 401); $httpClient = $this->getMockHttpClientWithHistoryAndResponses($container, [$response]); $client = new Client($httpClient); $client->initialize(['username' => 'test', 'password' => 'test']); /** @var CreateClassifierRequest $request */ $request = $client->createClassifier($this->request->getData()); $request->send(); }