1717
1818use Apisearch \App \AppRepository ;
1919use Apisearch \Config \Config ;
20+ use Apisearch \Exception \ResourceExistsException ;
21+ use Apisearch \Exception \ResourceNotAvailableException ;
2022use Apisearch \Model \AppUUID ;
2123use Apisearch \Model \IndexUUID ;
2224use Apisearch \Model \Token ;
@@ -49,14 +51,13 @@ public function testCreateIndex()
4951
5052 /**
5153 * Test create index already created.
52- *
53- * @expectedException \Apisearch\Exception\ResourceExistsException
5454 */
5555 public function testCreateIndexAlreadyCreated ()
5656 {
5757 $ inMemoryAppRepository = $ this ->getRepository ();
5858 $ inMemoryAppRepository ->setRepositoryReference (RepositoryReference::create (AppUUID::createById ('xxx ' )));
5959 $ inMemoryAppRepository ->createIndex (IndexUUID::createById ('yyy ' ), new Config ());
60+ $ this ->expectException (ResourceExistsException::class);
6061 $ inMemoryAppRepository ->createIndex (IndexUUID::createById ('yyy ' ), new Config ());
6162 }
6263
@@ -75,39 +76,36 @@ public function testDeleteIndex()
7576
7677 /**
7778 * Test delete index.
78- *
79- * @expectedException \Apisearch\Exception\ResourceNotAvailableException
8079 */
8180 public function testDeleteIndexAlreadyDeleted ()
8281 {
8382 $ inMemoryAppRepository = $ this ->getRepository ();
8483 $ inMemoryAppRepository ->setRepositoryReference (RepositoryReference::create (AppUUID::createById ('xxx ' )));
8584 $ inMemoryAppRepository ->createIndex (IndexUUID::createById ('yyy ' ), new Config ());
8685 $ inMemoryAppRepository ->deleteIndex (IndexUUID::createById ('yyy ' ));
86+ $ this ->expectException (ResourceNotAvailableException::class);
8787 $ inMemoryAppRepository ->deleteIndex (IndexUUID::createById ('yyy ' ));
8888 }
8989
9090 /**
9191 * Test delete non existing index.
92- *
93- * @expectedException \Apisearch\Exception\ResourceNotAvailableException
9492 */
9593 public function testDeleteNotExistingIndex ()
9694 {
9795 $ inMemoryAppRepository = $ this ->getRepository ();
9896 $ inMemoryAppRepository ->setRepositoryReference (RepositoryReference::create (AppUUID::createById ('xxx ' )));
97+ $ this ->expectException (ResourceNotAvailableException::class);
9998 $ inMemoryAppRepository ->resetIndex (IndexUUID::createById ('yyy ' ));
10099 }
101100
102101 /**
103102 * Test configure non existing index.
104- *
105- * @expectedException \Apisearch\Exception\ResourceNotAvailableException
106103 */
107104 public function testConfigureNotExistingIndex ()
108105 {
109106 $ inMemoryAppRepository = $ this ->getRepository ();
110107 $ inMemoryAppRepository ->setRepositoryReference (RepositoryReference::create (AppUUID::createById ('xxx ' )));
108+ $ this ->expectException (ResourceNotAvailableException::class);
111109 $ inMemoryAppRepository ->configureIndex (IndexUUID::createById ('yyy ' ), Config::createFromArray ([]));
112110 }
113111
0 commit comments